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

I would like to assign a library with a macro variable when the pathname includes a numerical folder name.

I want to create a library with the following path;

 

libname wsale '/sasserver/my_unit/data/Wholesale/201810';

I would like to derive 201810 from the user input which is 

%let USER_MTH_END = '31OCT2018'd; 

How can I create 201810 and then pass it to the libname statement? I've tried many things but I can't get it to work without manually typing 201810 in the libname statement.

 

Thanks in advance

1 ACCEPTED SOLUTION
3 REPLIES 3
catmad
Calcite | Level 5
Many thanks Kurt - that was very quick. I think I hadn't tried the correct combination of double quotes and a "." after the variable name.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Without double quotes macro variables will not get resolved, they just remain as the string '&...'.  The dot following the macro variable isn't technically needed in a lot of scenarios, it it there to tell the macro pre-processor that the macro variable name ends at the point, however in some circumtances it is really required, hence good practice is to always put the point at the end of the macro variable name - it will also highlight it as a macro variable in your code.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 2037 views
  • 0 likes
  • 3 in conversation