Help using Base SAS procedures

DATA step and memory requirements

New Contributor
Posts: 2

DATA step and memory requirements


I have a question regarding the memory usage of the DATA step. In a sample program like:

DATA weight;

     input ID $ Week1 Week16;



     2477 195 163

     2431 220 198

     2456 173 155

     2412 135 116



Where SAS stores the dataset "weight" while this step is running? Does it store it in RAM or in a temporary file in the filesystem? What if much more data is being read in this step?



Posts: 8,163

DATA step and memory requirements

I think the short answer would be both, but mostly in a temporary file.

New Contributor
Posts: 2

DATA step and memory requirements

Thanks art297.

Is there a way to prevent SAS from doing that and instead instruct it to just keep the dataset in RAM?

This way we avoid the I/O involved in writing temporary data out to the disk.


Trusted Advisor
Posts: 2,124

DATA step and memory requirements

Not really.  The data is stored in the WORK directory.  WORK is part of a file system in whatever OS you are using.  You might be able to store it in RAM if you created a virtual disk by using some of your RAM for that.  You could also create the data set as a VIEW; however, it would then do the I/O processing each time you went to use it.

In general, the advantage of SAS is that it can work with arbitrarily large data.  The flip side is that it is an I/O hog sometimes.

Doc Muhlbaier


Super User
Super User
Posts: 8,081

DATA step and memory requirements

Why?  If you want to do everything in RAM try using PROC IML.

Once you have a dataset you can use the SASFILE command to load it into RAM, but I cannot think of anyway to do it while creating the file. 

Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation