BookmarkSubscribeRSS Feed
u63406443
Calcite | Level 5

Hi All,

 

I am trying to connect with database using libname statement, for that I have created a macro variables and those variables is not fetched in libname statement. Can you all please look into the code and help me resolve the issue.

 

See difference in below two  libname statements in a password field.

code:

%let user=%str(rakesbx);
%let password=%str(rAk%B25%);

/*Libname cdl1 odbc datasrc="cdl2-hive" schema= abv_hcp360_besting_lease_ext user= "&user" password= "rAk%B25%";*/ ---> when I am trying these way and commenting the password variable  it is giving the result i.e.,:

 

Success result is:

 

u63406443_1-1698294331542.png

 


Libname cdl2 odbc datasrc="cdl2-hive" schema= abv_hcp360_opt_preference_ext user= "&user" password= "&password"; ----> when I am trying these way it is not giving the result i.e.,

 

Error result is:

u63406443_0-1698294159428.png

 

Thanks.

 

3 REPLIES 3
rudfaden
Lapis Lazuli | Level 10

Try Using %nrstr() instead of %str(). If you must use %str you need to mask you % signs like this %str(rAk%%B25%%)

u63406443
Calcite | Level 5

Thank you rudfaden, Got it.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 3 replies
  • 1404 views
  • 2 likes
  • 2 in conversation