| Date: | Wed, 23 Dec 1998 16:13:14 -0600 |
| Reply-To: | "Torres, Zzequiel" <Zzequiel.Torres@TRANSAMERICA.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | "Torres, Zzequiel" <Zzequiel.Torres@TRANSAMERICA.COM> |
| Subject: | Re: OBS= equivalent for output datasets? |
| Content-Type: | text/plain; charset="us-ascii" |
Have you tried...
_n_
easy example:
data yourstep (keep= whatever this that here there);
set example.sasdata;
if _n_ > 500 then stop; /* you'll get 499, it will read the 500th
ob(record) then stop */
run;
or note the difference......
data yourstep (keep= whatever this that here there);
set example.sasdata;
if your logic here;
if _n_ > 500 then stop; /* you'll get 499, it will read the 500th
ob(record) then stop */
run;
in this last example because you have logic (if , where, /* whatever
*/ ) it does not mean you'll get 499!
the _n_ is just a counter of where sas is in the PDV execution loop.
its very handy for testing code prior to letting it loose on MONSTER
datasets and debugging long/intricate jobs. you could build bigger
conditions with _n_.
hth. =)
zt.
>----------
>From: Jeff J. Voeller[SMTP:atrocity@MY-DEJANEWS.COM]
>Sent: Wednesday, December 23, 1998 2:53 PM
>To: SAS-L@UGA.CC.UGA.EDU
>Subject: OBS= equivalent for output datasets?
>
>We all know that SAS has that nifty little OBS= option for running tests on
>small portions of input datasets. But is there a way to apply similar logic
>to an output dataset?
>
>In other words, I want to process a DATA step until the result data reaches a
>certain number of observations, regardless of how many observations in the
>input dataset need to be read.
>
>For those familiar with SyncSort, what I'm suggesting is akin to how its
>STOPAFT= parameter works.
>
>I guess I could initialize a counter and then STOP when it hits my desired
>number...
>
>Thanks for any suggestions.
>
>
>-----== Sent via Deja News, The Discussion Network ==-----
>http://www.dejanews.com/ Easy access to 50,000+ discussion forums
>
|