BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nkm123
Calcite | Level 5

Is there any easy way to copy all dataset from work library to permanent library? Ex:- Suppose I have 10 dataset to be in work library (test1, test2 .. test10) and I want to copy all of them in permanent library ( libname data "/.") with same name.

 

Is there any proc that could do that or only way is to get work location and loop all dataset from work location and store it to permanent dataset ?

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

You might consider the SAS system option USER.  This will allow all one level names to be written to the library specified in the option.

 

https://support.sas.com/documentation/cdl/en/lesysoptsref/68023/HTML/default/viewer.htm#p1tl8adik7yp...

View solution in original post

5 REPLIES 5
Reeza
Super User

Proc copy or proc datasets. 

 

data_null__
Jade | Level 19

You might consider the SAS system option USER.  This will allow all one level names to be written to the library specified in the option.

 

https://support.sas.com/documentation/cdl/en/lesysoptsref/68023/HTML/default/viewer.htm#p1tl8adik7yp...

FreelanceReinh
Jade | Level 19

It's not quite clear from your post whether this is a one-time task or if you plan to do this regularly, occasionally or as part of a larger SAS program.

 

If you just want to prevent automatic deletion of the work datasets at the end of a SAS session, you can use the NOWORKTERM system option:

options noworkterm;

An easy way to copy SAS datasets and catalogs (perhaps you need work.formats, too?) manually from one library to another is to use the SAS Explorer.

 

As another alternative to SAS procedures, especially if you are familiar with the corresponding command of your operating system (copy, cp, ...), you can also let SAS submit this via an X command. As shown below (example for Windows), you don't need to know physical paths of libraries for this:

x "copy %sysfunc(pathname(work))\test*.sas7bdat C:\Temp";
nkm123
Calcite | Level 5

Thanks Reeza,  data _null_ and  . Appreciate all your help. Good learning in terms of user option. all solutions were very handy and what I was looking for. even used all of them in different project and for different need. Thanks again for your help.

nkm123
Calcite | Level 5

Thanks Reeza,  data _null_ and FreelanceReinhard . Appreciate all your help. Good learning in terms of user option. all solutions were very handy and what I was looking for. even used all of them in different project and for different need. Thanks again for your help.

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 2632 views
  • 0 likes
  • 4 in conversation