BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DoumbiaS
Quartz | Level 8

Hi to all,
I get these errors msg when my macro was simulating.

 

ERROR: Overflow has occurred; evaluation is terminated.
ERROR: The macro MYMACRO will stop executing.

 

How to fix it ? I welcome everything.

 

Regards

KD

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

After looking at the macro (got it in private message), I can only underline what @Reeza already suggested. Add %put statements that put your val_mid_1 and val_mid_2 macro variables into the log, so you can see their development.

 

I also see that you use numeric variables in call symput() without doing a proper conversion to character. This could cause problems creating texts in the macro variables that are then misinterpreted when the %if is resolved. Keep your code clean of any NOTEs about automatic type conversions, and make sure to use a put() function in call symput with a format that is suited to correctly display/convert your values.

 

PS I don't see anything in the macro that would reveal confidential data, so IMO you can post it safely here.

 

PPS to illustrate what happens when you have a format overflow in call symput:

%macro mymac;
%let a=5e5;
%let b=4e10;
%if &a > &b %then %put yes; %else %put no;
%mend;

%mymac

data _null_;
a=5e5;
b=4e10;
if a > b then put "yes"; else put "no";
run;

View solution in original post

8 REPLIES 8
PeterClemmensen
Tourmaline | Level 20

Show us some code 🙂

 

A simple google seach for the error message gave me this, perhaps that can be of help

 

http://support.sas.com/kb/42/348.html

DoumbiaS
Quartz | Level 8

I had also seen it before. But on after, they're talking

about SAS OpRisk VaR Server 4.2 that i don't have.

Thanks.

DoumbiaS
Quartz | Level 8

It is a macro of about 150 lines. It executes well for 1 to 3 iterations.

But fails to execute when i make for more iterations than 3.

Thanks

Kurt_Bremser
Super User

After looking at the macro (got it in private message), I can only underline what @Reeza already suggested. Add %put statements that put your val_mid_1 and val_mid_2 macro variables into the log, so you can see their development.

 

I also see that you use numeric variables in call symput() without doing a proper conversion to character. This could cause problems creating texts in the macro variables that are then misinterpreted when the %if is resolved. Keep your code clean of any NOTEs about automatic type conversions, and make sure to use a put() function in call symput with a format that is suited to correctly display/convert your values.

 

PS I don't see anything in the macro that would reveal confidential data, so IMO you can post it safely here.

 

PPS to illustrate what happens when you have a format overflow in call symput:

%macro mymac;
%let a=5e5;
%let b=4e10;
%if &a > &b %then %put yes; %else %put no;
%mend;

%mymac

data _null_;
a=5e5;
b=4e10;
if a > b then put "yes"; else put "no";
run;
Reeza
Super User

@DoumbiaS wrote:

Hi to all,

 

How to fix it ? I welcome everything.

 

 


Run the macro with MPRINT and SYMBOLGEN options. Add %PUT statements to the log.

With the vague information here we cannot suggest anything else.

DoumbiaS
Quartz | Level 8

After performing appropriate conversion using call symputx, no further overflow occurred. And needed iterations no longer fail.

Regards and Thanks

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 8 replies
  • 1337 views
  • 1 like
  • 4 in conversation