SAS Macro Errors

Accepted Solution Solved
Reply
Contributor
Posts: 62
Accepted Solution

SAS Macro Errors

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


Accepted Solutions
Solution
‎07-19-2017 08:16 AM
Super User
Posts: 7,763

Re: SAS Macro Errors

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;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
PROC Star
Posts: 734

Re: SAS Macro Errors

Show us some code Smiley Happy

 

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

Contributor
Posts: 62

Re: SAS Macro Errors

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.

Super User
Posts: 7,763

Re: SAS Macro Errors

Please show the macro code. You may be trying to put too much into a macro variable.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 62

Re: SAS Macro Errors

Posted in reply to KurtBremser

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

Super User
Posts: 7,763

Re: SAS Macro Errors


DoumbiaS wrote:

It is a macro of about 150 lines.


So what? Without seeing the code, we can't help you.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎07-19-2017 08:16 AM
Super User
Posts: 7,763

Re: SAS Macro Errors

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;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 19,772

Re: SAS Macro Errors


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.

Contributor
Posts: 62

Re: SAS Macro Errors

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

Regards and Thanks

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 135 views
  • 1 like
  • 4 in conversation