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