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.
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: