BookmarkSubscribeRSS Feed
durton15
Calcite | Level 5

Hi,

 

I’m using SAS 9.2 TS2M3 IML.

I’m running some simulations and get the following error after some repetitions.

 

ERROR: Out of memory for symbols. Cannot proceed.

 

If I decrease the number of repetitions this does not happen.

Do you know what I can try to do about it?

It is a program containing 8 macros.

 

Thankful for any help I can get.

 

 

6 REPLIES 6
ballardw
Super User

There are a couple of system options that control the the number of macro variables and macros.

MSYMTABMAX control the overall memory available to the symbol table.

You may need to increase the default value.

You can find your current value with:

proc options  group=macro;run;

 

change with

Options msymtabmax = n (or nK or nM or nG);

I might suggest

options msymtabmax=16m; to set 16 megabytes which might be about 4 times your default.

If you keep running into this limit it is often a symptom of sub-optimal macro coding.

 

Related settings to investigate may be MEXECSIZE adn MVARSIZE.

Rick_SAS
SAS Super FREQ

Well, I'm confused because usually the number of symbols in a simulation does not depend on the number of iterations. If you have a loop like

DO i = 1 to 10000;

   /* simulate data for the i_th sample */

END;

then the number of symbols is the same whether you loop 100, 10000. or 1E6 times.

 

My guess, then, is that you are doing something nonstandard (and potentially inefficient) like manufacturing names of symbols that depend on the iteration number. Can you attach your program?

durton15
Calcite | Level 5

Yes Rick you are right, I am using the iteration number to create some variables. 

I have attatched my program. Im thinking maybe its best if I rewrite my program and avoiding using the iteration numbers for creating variables.

 

I tried changing the number of macro variables and macros as ballardw suggested.

Also tried to increace symsize and worksize to 150.000 I think without success.

 

In my program, the problem occurs when im increasing P (number of variables in the simulated data set) to 20, 50, 100.

Then I am not allowed to to many replicates (R) at all. For P=20 I have managed to do 500 replicates. For P=50 I have manage to do 50 replicates.

 

Thanks

 

Rick_SAS
SAS Super FREQ

I don't know what you are trying to do, but SAS/IML has a DO loop, so in most situations you do not need to to use a %DO macro loop.

 

A few comments:

 

1. It looks like you might be trying to generate K covariance matrices in the first DO loop, and then you want to be able to refer back to them later in the program. If that is the case, you might just want to store the covariance matrices as rows in matrix that has K rows and P*P columns, as shown in the article "Create an array of matrices." (Or, since the matrices are symmetric, you can just store the upper triangular portion.)

 

2. Consider replacing those macros with SAS/IML functions calls. The SAS/IML language enables you to write self-contained user-defined functions called modules. The modules will be easier to write, debug, and maintain than macro code.

 

3. Learn about the built-in functions in SAS/IML that generate multivariate distributions.  It looks like the C matrices are supposed to be a random sample from the Wishart distribution with N-1 degrees of freedom.  You can generate those matrices with a single call to the RANDWISHART function, and they will be pre-packed into a matrix, as I suggested in my first comment.

 

 

durton15
Calcite | Level 5

Thank you for this information. It will definetly help me recode my program!

 

Ksharp
Super User

Make it bigger.

proc iml symsize=40000 worksize=40000;
print 'xxx';
quit;

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!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 6 replies
  • 1356 views
  • 1 like
  • 4 in conversation