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

Hello,

 

I want to create a single libname statement that works for my database(via authdomain) and also on my unix server.

 

I have this:

This works:
%let x=DB2 dsn="ABCDEF" authdomain='abc_d_efg' schema="nameofschema";

libname input &x.; /* No quotes*/

I can also have:

%let x=/path/on/unix/server/directory;

The above libname(WITHOUT) quotes will not work.

For this i will have to ADD the quotes.

This will work for second example:

libname input "&x.";

I need help with handling quotes.

Please advise, in what way i should code this. So that a single libname works for both.

 

Thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

Simple answer:

%let x="/path/on/unix/server/directory";

 

More complex and but much more flexible answer as you can tweak ad infinitum:

libname %sysfunc(ifc(%index(%superq(x),DB2),%superq(x),"&x")) ;

 

View solution in original post

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Simple answer:

%let x="/path/on/unix/server/directory";

 

More complex and but much more flexible answer as you can tweak ad infinitum:

libname %sysfunc(ifc(%index(%superq(x),DB2),%superq(x),"&x")) ;

 

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
  • 1 reply
  • 1277 views
  • 0 likes
  • 2 in conversation