Date: Fri, 15 Jul 2011 17:01:22 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: Sample large datasets with observations logically removed
In-Reply-To: <CAEZCysuni7X9qx4X3o3WR2GJNYFn6H4SRvDCpUhKb_ugdVFeTw@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Data _null_ don't have good grammer.
You "could" pick AN OBS and if not found skip to the next until an
undeleted obs is found. The variable you need is _ERROR_.
On Fri, Jul 15, 2011 at 4:59 PM, Data _null_; <iebupdte@gmail.com> wrote:
> You "could" pick and OBS and if not found skip to the next until and
> undeleted obs is found. The variable you need is _ERROR_;
>
> data have;
> input num;
> cards;
> 1
> 2
> 3
> ;
>
> data have;
> modify have;
> if num=2 then remove;
> run;
>
> data _null_;
> do i=2 to nobs by 1 until(_error_ eq 0);
> _error_ = 0;
> set have point=i nobs=nobs;
> if _error_ eq 1 then put 'NOTE: NO obs=' i;
> else put _all_;
> end;
> stop;
> run;
>
> On Fri, Jul 15, 2011 at 1:22 PM, bbser 2009 <bbser2009@gmail.com> wrote:
>> Greetings!
>>
>> If we run the code below, we will get the error indicated in the log.
>> Now imagine the data set have is very large and we do not want to make any
>> change on it.
>> Then how can we avoid such errors when sampling the data set? Thank you.
>>
>> Max
>> (Maaxx)
>>
>> =========== log
>> 98 data _null_;
>> 99 do i=2;
>> 100 set have point=i;
>> 101 end;
>> 102 stop;
>> 103 run;
>>
>> i=2 num=. _ERROR_=1 _N_=1
>> NOTE: DATA statement used (Total process time):
>> real time 0.02 seconds
>> cpu time 0.01 seconds
>>
>>
>> ============ code
>> data have;
>> input num;
>> cards;
>> 1
>> 2
>> 3
>> ;
>>
>> data have;
>> modify have;
>> if num=2 then remove;
>> run;
>>
>> data _null_;
>> do i=2;
>> set have point=i;
>> end;
>> stop;
>> run;
>>
>
|