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,
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.
Proc copy or proc datasets.
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.
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";
Thanks Reeza, data _null_ and FreelanceReinha
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.
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.
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.