BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
EinarRoed
Pyrite | Level 9

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.

1 ACCEPTED SOLUTION

Accepted Solutions
japelin
Rhodochrosite | Level 12

try change from

'&prefix._temp';

to

"&prefix._temp";

 

Single quotation marks do not resolve macros, while double quotation marks do.

View solution in original post

2 REPLIES 2
japelin
Rhodochrosite | Level 12

try change from

'&prefix._temp';

to

"&prefix._temp";

 

Single quotation marks do not resolve macros, while double quotation marks do.

EinarRoed
Pyrite | Level 9
Ugh, I should've remembered. Thanks. 🙂

sas-innovate-white.png

Special offer for SAS Communities members

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.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1326 views
  • 1 like
  • 2 in conversation