After Reading multiple threads i'm able to write below code, but not getting output...
Please help !!
Code :
libname abc 'C:\Users\Sony\Desktop\datasets';
OPTIONS SYMBOLGEN;
proc sql noprint;
select memname into: names seprated by ''
from Dictionary.tables
where libname="ABC" ;
quit;
data want;
set abc.&names;
run;
Error :
SYMBOLGEN: Macro variable NAMES resolves to WORK1WORK2WORK3
180 set abc.&names;
ERROR: File ABC.WORK1WORK2WORK3.DATA does not exist.
It should be
select catx('.', 'abc', memname) into :names separated by ' '
Your currently generating a macro variable that looks like:
Work1 Work2 Work3
You need to create
abc.work1 abc.work2 etc...
You have a spelling mistake in your PROC SQL and are missing the library portion of the name.
If they all have the same prefix you can use the colon shortcut instead.
Data want;
set abc.work:;
run;
It should be
select catx('.', 'abc', memname) into :names separated by ' '
Your currently generating a macro variable that looks like:
Work1 Work2 Work3
You need to create
abc.work1 abc.work2 etc...
You have a spelling mistake in your PROC SQL and are missing the library portion of the name.
If they all have the same prefix you can use the colon shortcut instead.
Data want;
set abc.work:;
run;
I've corrected the line "seprated by ' '
but now i'm not getting why work1, work2 & work3 are searching in work library. I've given abc.&names
Code :
libname abc 'C:\Users\Sony\Desktop\datasets';
OPTIONS SYMBOLGEN;
proc sql noprint;
select memname into: names seprated by ' '
from Dictionary.tables
where libname="ABC" ;
quit;
data want;
set abc.&names;
run;
Error :
SYMBOLGEN: Macro variable NAMES resolves to WORK1 WORK2 WORK3
360 set abc.&names;
ERROR: File WORK.WORK2.DATA does not exist.
ERROR: File WORK.WORK3.DATA does not exist.
Still you need to add the function catx('.', 'abc', memname) which will append each of the datasets name with the library abc .
Thanks,
Monika
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.