BookmarkSubscribeRSS Feed
sandyming
Calcite | Level 5

I have many inlib1, inlib2 libraries. I would like to concatenate all the directory to one macro variable NAME.

%put &name; looks fine, but log has the following error message. Anyone has an idea how to fix this? Thanks.

%macro fmt(inlib1=, inlib2=);

  %let name=%str("&inlib2","&inlib1",&name);

%mend;

%fmt(inlib1=%str(c:\temp1\p_v1), inlib2=%str(c:\temp1\p_v2));

Error Msg:

Some characters in the above value which were subject to macro quoting have been unquoted for printing.

Sandy

2 REPLIES 2
Astounding
PROC Star

From the snippet of the code that you show, there is no need to apply quoting functions.  All of the %str usage could be removed.  There may be reasons you need it for other sections of your code, but you don't need it for the pieces you have shown.

It's curious as to where you are getting the error message.  None of your code actually prints anything.  So there must be more to this than you are showing.  If you post more of what you are trying to accomplish, it may turn out that there are other methods that don't involve concatenating all the names, but that's another story.

Good luck.

sandyming
Calcite | Level 5

Thanks, Astounding.

I made a mistake at one place, missed a parenthesis Smiley Sad, %fmt(inlib1=%str(c:\temp1\p_v1), inlib2=%str(c:\temp1\p_v2);

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 707 views
  • 0 likes
  • 2 in conversation