Hello
I want to create a new data set by set multiple data sets that appear in another data set.
For example:
in data set "helptbl" we can see the names of the data sets that will be in SET statement.
What is the way to tell SAS to using these name for SET statement (without doing it manually...)
data helptbl;
input tblnames;
cards;
tbl190828
tbl190825
tbl190821
tbl190812
tbl190803
;
run;
Data tbl_all;
set tbl190828
tbl190825
tbl190821
tbl190812
tbl190803
;
run;
data helptbl;
input tblnames $9.;
cards;
tbl190828
tbl190825
tbl190821
tbl190812
tbl190803
;
run;
proc sql noprint;
select tblnames into :tname separated by ' ' from helptbl;
quit;
Data tbl_all;
set &tname.;
run;
Hi @Ronein
If you want to append all the datasets beginning by "tbl" of a library, you can directly do this by using the following code :
data want;
set tbl:;
run;
Otherwise, if you want to append only some of these datasets (which are listed in the helptbl dataset), the solution provided by @Coooooo_Lee would work.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.