I've got some code that's being reused by 5 SAS-scripts that's running in parallel. Each of the 5 scripts have a prefix-macro that's used in the reusable code, to make sure that work table names are unique.
Example: The 1st SAS-script sets %let prefix = cust, and the 2nd sets %let prefix = prod. Then the reusable code uses a work table called &prefix._temp.
This fails because MEMNAME doesn't accept the prefix-macro:
data _null_;
set sashelp.vcolumn end=eof;
where libname = 'WORK' and lowcase(memname) = '&prefix._temp';
run;
If I use this it works:
data _null_;
set sashelp.vcolumn end=eof;
where libname = 'WORK' and lowcase(memname) = 'cust_temp';
run;
Is there a way to make MEMNAME work with my prefixes? If I type the prefix manually it's no longer reusable.
try change from
'&prefix._temp';
to
"&prefix._temp";
Single quotation marks do not resolve macros, while double quotation marks do.
try change from
'&prefix._temp';
to
"&prefix._temp";
Single quotation marks do not resolve macros, while double quotation marks do.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.