From: "Data _null_;" on
data test;
do _n_ = 1 to 100;
output;
end;
do until(eof);
set sashelp.class end=eof;
output;
end;
stop;
run;
data need;
set test(obs=9 where=(not missing(weight)));
run;
proc print;
run;

On 1/11/10, William Shakespeare <shakespeare_1040(a)hotmail.com> wrote:
> Familiar with the function. Not sure how to apply it in this case. I
> only want the first 1000 records that are not missing(VAR1). How do I
> limit to 1000?
>
From: Kulpreet Khanna on
On Jan 12, 7:29 am, shakespeare_1...(a)HOTMAIL.COM (William Shakespeare)
wrote:
> I have a data set with millions of records.  I want to pick out the first
> 1000 records with VAR1 ne missing.  My file is sorted on VAR1 but I don't
> know how many missing values there are (so I can't use >=_n_=x and <=
> _n_=1000+x).  How else could I get to this?

Hi,
The simplest way is to separate non-missing values into another
dataset and then pick up first 1000 observations.

data x;
set input(where=(var1 ne .));
run;

data y;
set x(obs=1000);
run;
From: =?ISO-8859-1?Q?Daniel_Fern=E1ndez?= on
hi,

other method as good as Data _Null_ �s :

data have;
do _n_ = 1 to 950; *950 lines;
var1=.;
output;
end;
var1=0;
do _n_= 1 to 250; *1200 cumulative lines;
var1 + 1; * 250 of them with 'var1' NOT MISSING;
output;
end;
do _n_ = 1 to 300; *1500 cumulative lines;
var1=.;
output;
end;
var1=250;
do _n_= 1 to 3500; *5000 cumulative lines;
var1 + 1; * 3750 of them with 'var1' NOT MISSING;
output;
end;
run;

data need;
set have(where=(var1 NE .));
if _n_=1001 then stop;
run;

Daniel Fernandez
Barcelona



2010/1/12 Data _null_; <iebupdte(a)gmail.com>:
> data test;
> do _n_ = 1 to 100;
> output;
> end;
> do until(eof);
> set sashelp.class end=eof;
> output;
> end;
> stop;
> run;
> data need;
> set test(obs=9 where=(not missing(weight)));
> run;
> proc print;
> run;
>
> On 1/11/10, William Shakespeare <shakespeare_1040(a)hotmail.com> wrote:
>> Familiar with the function. Not sure how to apply it in this case. I
>> only want the first 1000 records that are not missing(VAR1). How do I
>> limit to 1000?
>>
>