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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.