BookmarkSubscribeRSS Feed
ashwini2
Fluorite | Level 6
options mprint;
 %MACRO V22I9ED1(AGE=, SEX=, ICD9= );

   IF &SEX= "2" AND &ICD9 IN ("2860", "2861")  THEN CC=" 48 "; 
   ELSe IF &AGE < 18 AND &ICD9 IN ("4910", "4911", "49120", "49121", "49122",
                              "4918", "4919", "4920", "4928", "496",  
                              "5181", "5182") THEN CC=" 112 ";
   ELSE IF &AGE < 18 AND &ICD9 IN ("49320", "49321", "49322") 
                                              THEN CC=" -1 ";

 
%IF &SEDITS = 1 %THEN %DO;
    
     _TAGE=PUT(&ICD9, $&AGEFMT9..);
     IF _TAGE NE "-1" AND
        (&AGE < INPUT(PUT(_TAGE, $AGEL.),8.) OR
         &AGE > INPUT(PUT(_TAGE, $AGEU.),8.)) THEN CC='-1';

    
     _TSEX=PUT(&ICD9, $&SEXFMT9..);
     IF _TSEX NE "-1"  & _TSEX NE &SEX THEN CC='-1';

  %END;
 %MEND V22I9ED1;

Error is attached below: Could somebody please help me with it?

 

Capture.PNG

3 REPLIES 3
ashwini2
Fluorite | Level 6
options mprint;
 %MACRO V22I9ED1(AGE=, SEX=, ICD9= );

   IF &SEX= "2" AND &ICD9 IN ("2860", "2861")  THEN CC=" 48 "; 
   ELSe IF &AGE < 18 AND &ICD9 IN ("4910", "4911", "49120", "49121", "49122",
                              "4918", "4919", "4920", "4928", "496",  
                              "5181", "5182") THEN CC=" 112 ";
   ELSE IF &AGE < 18 AND &ICD9 IN ("49320", "49321", "49322") 
                                              THEN CC=" -1 ";

 
%IF &SEDITS = 1 %THEN %DO;
    
     _TAGE=PUT(&ICD9, $&AGEFMT9..);
     IF _TAGE NE "-1" AND
        (&AGE < INPUT(PUT(_TAGE, $AGEL.),8.) OR
         &AGE > INPUT(PUT(_TAGE, $AGEU.),8.)) THEN CC='-1';

    
     _TSEX=PUT(&ICD9, $&SEXFMT9..);
     IF _TSEX NE "-1"  & _TSEX NE &SEX THEN CC='-1';

  %END;
 %MEND V22I9ED1;

Attached is the error message


Capture.PNG
Reeza
Super User

You  need to post more of your log, specifically, how are you calling the macro.

 

 

ballardw
Super User

And run the code with OPTIONS MPRINT;

Many times the displayed error message is way after the line of code with the issue and MPRINT helps with that plus showing the resolved values of the macro code.

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1741 views
  • 0 likes
  • 3 in conversation