LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 25 Jun 2009 11:18:46 -0700
Reply-To:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Organization:   http://groups.google.com
Subject:   Re: Split Dataset
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On Jun 25, 3:22 am, ash007 <RamsamyAsh...@gmail.com> wrote: > Hello SasUsers, > > I have a dataset which have a variable named X, this numeric variable > has either '1', '0' or '.'. > > I want to split this dataset in order to have several dataset between > 1 and 0. > > X > . > . > . > 1 > . > . > 0 > 1 > . > . > . > . > 0 > . > . > > I want to have in this case 2 datasets : > > dst_1 > X > 1 > . > . > 0 > > dst_2 > X > 1 > . > . > . > . > 0 > > Thanks. > > Ash007.

Ash:

Why split the data at all ? You might be better off adding a categorical variable so that you can do BY and/or CLASS based processing.

data foo;

do _n_ = 1 by 1 until (x=1); link doSet; end;

do _n_ = 1 to _n_-1; link doSet2; end;

do _n_ = 1 by 1 until (x=0); link doSet; end;

* output only complete groups (start at 1 end at 0);

groupId + 1; do _n_ = 0 to _n_; link doSet2; OUTPUT; end; return;

doSet: set MyData; return; doSet2: set MyData; return;

run;


Back to: Top of message | Previous page | Main SAS-L page