DATA Step, Macro, Functions and more

SAS insufficient memory

New Contributor
Posts: 2

SAS insufficient memory


I've run into an insufficient memory issue when running exact logistic (PROC LOGISTIC).  


I've been reviewing the boards and tried out the solutions I've run across so far, setting:



These were achieved - and confirmed via PROC OPTION - by setting my SAS 9.3 shortcut to:

"C:\Program Files\SASHome\SASFoundation\9.3\sas.exe" -CONFIG "P:\My SAS Files\9.3\sasv9.cfg" -memsize 3000M -memmaxsz 3000M


However, in watching my Windows Task Manager, I am still seeing the Memory top out at about 1.76GB before ending and giving me the error message - which is approximately where it had been topping out prior to my changes to MEMSIZE and MEMMAXSZ. This has also occurred whether the total physical memory (at bottom of the Task Manager) reads 83% or 93%.  I can understand there being issues at the latter, which is why I closed most of the remaining applications.

Am I missing another option that needs to change to allow that 1.76GB to creep higher toward the intended maximum of 3GB?


I understand why the analyses will be a memory drain given their associated sample size and models, but some of the set I'm examining have sufficient memory and I'd like to max out SAS's memory allocation in the event it will help get them all to run.

Thanks in advance for any assistance!


Processor: Intel Core i5-3570 3.40GHz

32-bit OS with 4GB RAM ( allocation) 

Regular Contributor
Posts: 212

Re: SAS insufficient memory

[ Edited ]

Hi mate

Maybe try to use:


options compress=yes reuse=yes;

Maybe this can compress a little your results.

Or try MEMSIZE System Option: Windows


Hope this helps

Regular Contributor
Posts: 212

Re: SAS insufficient memory

@cstopp, check out...

By @ChrisHemedinger


SAS manages the memory for you, so it's similar to Java or .NET in that way. But there isn't a garbage collection mechanism per se. SAS programs consist of a series of "steps" -- the DATA step and PROC steps (for SAS procedures). For the most part, memory is allocated as needed during the running step, then released when the step is complete.


Some SAS procedures can use a lot of memory during the course of their work, and you can run out of memory when working with large data or data sets with large cardinality. For example, PROC FREQ can compute n-way frequencies quickly, but if the variables you're analyzing have lots of distinct values, you can bump into memory limits. When this happens, SAS will issue an ERROR message to the SAS log indicating that there wasn't enough memory to complete the operation.


The SAS DATA step also offers some constructs that are inherently memory-dependent. The most popular is thehash object, which allows you to load lots of data values into memory and manipulate them quickly. It's good for building fast data management algorithms, as long as the data values can fit into memory.


Finally, when we talk about memory management in SAS, we also have to address the WORK area: the temporary scratch space on disk where SAS can write files as intermediate results while SAS procedures run. In practice, most SAS programs that deal with large data sets will run into WORK space limitation before they hit memory constraints. On administered SAS environments, it's important to ensure that SAS programs have access to enough WORK space (ideally with fast I/O performance) to accomplish their work.


For more admin-friendly tips, see this series of blog posts from my colleague Margaret Crevar.


Check out this How does memory management work in SAS?


Super User
Posts: 3,112

Re: SAS insufficient memory

I suspect that having 32-bit Windows is part of the problem. 2GB is close to the limit for 32-bit Windows apps. Do you have access to 64-bit Windows and SAS? You should be able to go a lot higher with that combination.


Failing that can you simplify you LOGISTIC program to use less memory?

New Contributor
Posts: 2

Re: SAS insufficient memory

Thank you all for your feedback - it is certainly appreciated.

I will try a combination (e.g. adding the options, reducing the temp work folder contents) to see what can be had and keep reading.  Based on what I've seen, I feel I'm on the cusp of getting there, which is why I joined to ask.

Regarding the memory - yes, I'm confident based on work at a previous employer that a 64bit and corresponding bump in available memory allowance would be far more than adequate. Frankly, I doubt I would find such a machine (PC or server) available where I currently am though.

Cheers and thanks again!

Ask a Question
Discussion stats
  • 4 replies
  • 1 like
  • 3 in conversation