BookmarkSubscribeRSS Feed
Calcite | Level 5


I am a new user in SAS. I have shifted from R. I am dealing with a large data (hospitalization).

Everyday I open SAS, I loose a  lot of time to run all the previous codes to get the formatted and structured data for further use.

In R I used to save workspace and thus everyday when I start I could get back the latest works of previous day.

Is it possible here with SAS to save workspace given that I have SAS Base and Enterpirse Guide?


Opal | Level 21

If you save your files in a permanent directory (e.g., use a libname statement to define a library like:

  libname mydata "c:\current_data";

then, in your code, rather than just creating the files in your work directory (i.e., using something like:

data step1;



Create them as permanent files.  e.g.:

data mydata.step1;



Then, the next day, you just have to run the one line:  libname mydata "c:\current_data";

and all of your files will be accessible



SAS supports a neat trick that lets you save the WORK area with minimal changes to your SAS program.  These changes have to be implemented at the beginning of your program, before adding to the WORK area.

As Art mentioned, you have to pre-define a folder where the WORK area will reside, using a LIBNAME statement.  From that point, however, you don't need to change the subsequent DATA and PROC steps.  Instead, add this line to the program (assuming the LIBNAME statement defined "mydata"):

options user=mydata;

The default option is user=WORK.  That's why your one-level data set names get stored in the WORK library.

Here's the part I'm not sure about.  If you want to re-use the same WORK area in a subsequent program, is it as simple as adding the same two lines to the subsequent program?  I suspect it is, but I'm not positive about that.

Of course, Art's method will give you better control if you wish to save just part of the WORK area and discard the rest.

Good luck.

Calcite | Level 5

Thanks a lot Art297 & Astounding.

I have applied method of Art297. While reopening, it was not throwing the data and may be that was because of more complication of the program.e.g.

data work.a;

set permanent.b;




set work.a;

/* formatting, restructuring, reformating, count */


So can anybody help me to understand why I cannot retrieve my saved data in permanent library, even though I gave the path for the libref next day ?


What you were suspicious I tried. It works even when model output is needed to retrieve but in my purpose regarding several times formatting, restructuring, SQL joins etc, it is not working. So till now what way I have is to export all to csv at the end of the day and import on the next day. U know it causes loss of information that are capable with SAS data.

Calcite | Level 5

This post from Angela Hall might help.



Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.


Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 


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
  • 4 replies
  • 4 in conversation