BookmarkSubscribeRSS Feed
shravanisreeyan
Fluorite | Level 6

data have:

input libref $  path$30.;

cards;

sai     C:\Users\SAIKIRAN PATEL\Desktop\SPRETNOST

ravi    C:\Users\SAIKIRAN PATEL\Desktop\new

rahul  C:\Users\SAIKIRAN PATEL\Desktop\oldest

;

run;

Here i want create all libraries at once ?

Many thanks

 

 

2 REPLIES 2
Reeza
Super User

Use the libname function. 

 

data want;
set have;

rc = libname(libref, path);

run;

 

rc will hold the return values. 

 

From the docs:

 

The LIBNAME function assigns or clears a libref from a SAS library. When you use the LIBNAME function with two or more arguments, SAS attempts to assign the libref. When you use one argument, SAS attempts to clear the libref. Return codes are generated depending on the value of the arguments that are used in the LIBNAME function and whether the libref is assigned.

When assigning a libref, the return code is 0 if the libref is successfully assigned. If the return code is nonzero and the SYSMSG function returns a warning message or a note, then the assignment was successful.

 

If the SYSMSG function returns an error, then the assignment was unsuccessful.

 

If a library is already assigned, and you attempt to assign a different name to the library, the libref is assigned, the LIBNAME function returns a nonzero return code, and the SYSMSG function returns a note.

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=lefunctionsref&docsetTarg...

 


@shravanisreeyan wrote:

data have:

input libref $  path$30.;

cards;

sai     C:\Users\SAIKIRAN PATEL\Desktop\SPRETNOST

ravi    C:\Users\SAIKIRAN PATEL\Desktop\new

rahul  C:\Users\SAIKIRAN PATEL\Desktop\oldest

;

run;

Here i want create all libraries at once ?

Many thanks

 

 


 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 1125 views
  • 3 likes
  • 3 in conversation