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

%let year=1986;

%let month=12;

libname birth "p:\sas\high\five\&year.&month.";

 

Why the libreference not exist? Anything wrong with the macro variable? Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Hi @runrunrunbunny ,

 

As well as the good suggestions already made, if you haven't assigned a library before on the system you're using then you might find the path should be specified with forward slashes ("/") rather than back slashes ("\") and then possibly with some other path information in place of the "p:".

 

Depending upon the SAS product you are using, you might be able to assign the library using a wizard to confirm the path is correct.

 

Lastly, try assigning a library to the first folder in the path, then if that works try assigning a library to the second folder in the path, and so on, until you get to the point where you get the same message and the library cannot be assigned then that would indicate where the path is going wrong.

 

 

Kind regards,

Amir.

View solution in original post

9 REPLIES 9
novinosrin
Tourmaline | Level 20

Hi @runrunrunbunny  Please post your LOG? Also, what is your expected resolution of the macro variable that would point to a particular folder ? 

 

If by any chance p: is a mapped drive, you could even try writing the full extension from left to right of each folder and sub folder. 

runrunrunbunny
Calcite | Level 5
Many thanks!
WarrenKuhfeld
Ammonite | Level 13

If by chance you are trying to get this:

libname birth "p:\sas\high\five\1986.12";

Then insert a period after the period after your year macro variable:

libname birth "p:\sas\high\five\&year..&month.";

runrunrunbunny
Calcite | Level 5
Thank you for your help!
andreas_lds
Jade | Level 19

When working with macro-code or macro-variables you should enable some debugging options, at least mprint, sometime symbolgen and mlogic are useful, too, so that you can check whether the generated sas code matches your expectation.

runrunrunbunny
Calcite | Level 5
Thanks a lot!
runrunrunbunny
Calcite | Level 5
Thank you so much!
Amir
PROC Star

Hi @runrunrunbunny ,

 

As well as the good suggestions already made, if you haven't assigned a library before on the system you're using then you might find the path should be specified with forward slashes ("/") rather than back slashes ("\") and then possibly with some other path information in place of the "p:".

 

Depending upon the SAS product you are using, you might be able to assign the library using a wizard to confirm the path is correct.

 

Lastly, try assigning a library to the first folder in the path, then if that works try assigning a library to the second folder in the path, and so on, until you get to the point where you get the same message and the library cannot be assigned then that would indicate where the path is going wrong.

 

 

Kind regards,

Amir.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 9 replies
  • 2059 views
  • 2 likes
  • 6 in conversation