Hello Everyone,
Is there any way to shorten the below code since all "have" files are from the same lib?
Thank you,
HHCFX
data want; set libname.have1 libname.have2 libname.have3 libname.have4;run;
Then there's no way to reduce the set statement. Unless you have some criteria that helps you in selecting your datasets from dictionary.tables and putting all dataset names (including the library) into a macro variable.
Then there's no way to reduce the set statement. Unless you have some criteria that helps you in selecting your datasets from dictionary.tables and putting all dataset names (including the library) into a macro variable.
Thanks for your info.
I hope it could be something like libname.( list of datasets...);
Yes, this should be achieved, because you already have the data sets which are in numbered range lists. You can try below:
data want; set libname.have1-libname.have4; run;
Hi @hhchenfx Try to read the dataset names from dictionary tables and create a list macrovar. Then call the macrovar in your set statement. This can help you avoid typing
Following up on @novinosrin suggestion:
%let myLib=WORK;
proc sql noprint;
select catx(".", "&myLib", memname) into :name_list separated by " "
from sashelp.vtable
where libname=upcase("&myLib.");
quit;
data want;
set &name_list;
run;
This approach works if you have less than 1500+ variables due to the length restrictions of a SAS macro variable.
@hhchenfx wrote:
Hello Everyone,
Is there any way to shorten the below code since all "have" files are from the same lib?
Thank you,
HHCFX
data want; set libname.have1 libname.have2 libname.have3 libname.have4;run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.