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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 3 replies
  • 1018 views
  • 0 likes
  • 3 in conversation