DATA Step, Macro, Functions and more

Assignment of Library using another library

Accepted Solution Solved
Reply
Super Contributor
Posts: 266
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,516

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,437

Re: Assignment of Library using another library

Super Contributor
Posts: 266

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,516

Re: Assignment of Library using another library

Have you tried inserting parentheses around (lib1)  

Super User
Posts: 7,854

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: 19,868

Re: Assignment of Library using another library

You want Example 2 in the link provided. 

 

 

Libname lib2 (lib1);

Super Contributor
Posts: 266

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
  • 150 views
  • 4 likes
  • 5 in conversation