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.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.