I have the following datasets in a list;
proc sql noprint;
select distinct MEMNAME
into :MEM_LIST separated by " "
from DICTIONARY.COLUMNS
where LIBNAME="PMODA";
quit;
%put &MEM_LIST;
APR_19 APR_20 AUG_19 DEC_19 FEB_19 FEB_20 JAN_19 JAN_20 JUL_19 JUN_19 MAR_19 MAR_20 MAY_19 NOV_19 OCT_19 SEP_19 YEAR_TO_DATE_19
However, I want to only have datasets which end in _19 in my variable called mem_list.
I've tried to use and memname like "19%" in my sql query but this does appear to pick it up.
Can anyone provide some suggestions, please?
Well if you are filtering using LIBNAME='PMODA' , you would only have those datasets in that library.
Hmm, I am wondering whether you are asking to concatenate the libname with memname? Is this correct?If yes, you may want to do this-
select distinct catx('.',libname,MEMNAME) as memname
select distinct catx('.',libname,MEMNAME) as memname
into :MEM_LIST separated by " "
from DICTIONARY.COLUMNS
where LIBNAME="PMODA";
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.