Help using Base SAS procedures

Reg:First obs from all Datasets in a library

Reply
Contributor
Posts: 66

Reg:First obs from all Datasets in a library

Hi

I am having a library names NEW in that i have 20 datasets like A,RB,CA,DQ,EO,TF,G,Jk,Ed,LO,PI,UI,TY,QW.....with variable names ex-Age id no name in all the above datasets
Now i want to create a new dataset a21 with all the first observarions from datasets names above in to new dataset a21.
Respected Advisor
Posts: 3,889

Re: Reg:First obs from all Datasets in a library

Syntax working for SAS9.2:

data a_1 a_2 a_3;
do i=1 to 5;
output;
end;
run;

data a_all;
set a_1 -a_3 (obs=1);
run;

Before SAS9.2 it would be:
set a_1(obs=1) a_2(obs=1).... ;


Message was edited by: Patrick
Valued Guide
Posts: 2,175

Re: Reg:First obs from all Datasets in a library

sas_

do you have SAS9.2 or which earlier release?

hth
PeterC.
Contributor
Posts: 66

Re: Reg:First obs from all Datasets in a library

i am having sas 9.2 .
Occasional Contributor P_J
Occasional Contributor
Posts: 10

Re: Reg:First obs from all Datasets in a library

Please try something like this to see if it works, I'm using 9.1.3

proc sql;
select cats("NWK.",memname) into :dsn separated by " "
from sashelp.vstable
where libname ="NWK"
;
quit;

options obs=1;
data all;
set &dsn;
run;


%put &dsn=;
Contributor
Posts: 66

Re: Reg:First obs from all Datasets in a library

Thqs it worked
Ask a Question
Discussion stats
  • 5 replies
  • 321 views
  • 0 likes
  • 4 in conversation