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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1554 views
  • 2 likes
  • 2 in conversation