|
Minze,
If you do not want to read the entire dataset you can use point=
data pipo;
do i = 1 to 100;
output;
end;
run;
data pipo2;
set pipo point=n_records nobs=n_records;
put _all_;
output;
stop;
run;
In the log:
n_records=100 i=100 _ERROR_=0 _N_=1
NOTE: The data set WORK.PIPO2 has 1 observations and 1 variables.
NOTE: DATA statement used:
real time 0.00 seconds
cpu time 0.00 seconds
Do not forget the output and the stop statement.
Hope this is helpful,
Joep
zhichao.luo schreef:
> You can use this way, then you can selcet what ever obs you want.
> I also curious about how to use _n_ to select obs, but I don't find
> the method. So I find a more complex way to slect obs I need.8-)
>
> /*This step to make a variate which is the same as obs*/
> data temp;
> set temp(in=a);
> if a;
> n+1;/*n is obs*/
> run;
>
> /* you can change the value of n to select whatever obs you like*/
> proc sql;
> select * from temp where n= (select count(*) from temp);
>
>
>
> "Minze Su дµÀ£º
> "
> > hi all:
> >
> > I want to know how to get the last observation by using the data step.
> >
> > Maybe _n_ £½ last I think £¿ but does anyone know£¿
> >
> > Thanks
> >
> > BR£¬
> >
> > Minze
|