DATA Step, Macro, Functions and more

Assignment of Library using another library

Accepted Solution Solved
Reply
Regular Contributor
Posts: 241
Accepted Solution

Assignment of Library using another library

I have a preassigned library Lib1.  

Libname Lib1 "C:\MyDevWork\folder\";

 

In the code, library Lib2 being used a lot. Lib2 is same as Lib1, One way of creating Lib2 is use the path of Lib1 in libname statement. 

 

I want to know -"Is there any way I can create Libname for Lib2 using Lib1 without worrying the path of Lib1?" 


Accepted Solutions
Solution
‎03-28-2017 12:42 AM
Super User
Posts: 5,085

Re: Assignment of Library using another library

Have you tried inserting parentheses around (lib1)  

View solution in original post


All Replies
Super User
Posts: 5,257

Re: Assignment of Library using another library

Regular Contributor
Posts: 241

Re: Assignment of Library using another library

I tried followig but it did not worked

 

Libname Lib2 base lib1;

 

Please help.

Solution
‎03-28-2017 12:42 AM
Super User
Posts: 5,085

Re: Assignment of Library using another library

Have you tried inserting parentheses around (lib1)  

Super User
Posts: 6,946

Re: Assignment of Library using another library

You could also try

libname lib2 "%sysfunc(pathname(lib1))";
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 17,865

Re: Assignment of Library using another library

You want Example 2 in the link provided. 

 

 

Libname lib2 (lib1);

Regular Contributor
Posts: 241

Re: Assignment of Library using another library

Thank you everyone for quick reply. it is helpful.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 147 views
  • 4 likes
  • 5 in conversation