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
Pyrite | Level 9

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