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")) ;

 

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