Hello Everyone.
I need help to solve this macro. My macro is as below:
%macro checkabc();
%if %sysfunc(scan(&SCREAM,-1,'_') eq 'ABC' %then %do;
%let SCREEN = %sysfunc(tranwrd(&SCREAM,'_ABC',)
%END;
%end;
%checkabc;
i am getting the following error:
ERROR: Macro keyword DO appears as text. ERROR: A dummy macro will be compiled. 90 + %let SCREAM = %sysfunc(tranwrd(&SCREAM,'_ABC',) ERROR: Macro keyword LET appears as text. 91 + %END; 92 +%end; ERROR: Macro keyword END appears as text.
I suspect 1 or more code is not quoted properly/wrongly used. I need advice on how to improve this macro.
Hope to get advice soon. 🙂
Thanks a lot everyone.
Thanks for the help. I missed out 2 right parenthesis.
I also added 2 single quote in tranwrd.
However, I am still getting error as below.
ERROR: Macro keyword END appears as text. ERROR: A dummy macro will be compiled.
My current macro code:
%macro checkabc();
%if %sysfunc(scan(&SCREAM,-1,'_')) eq 'ABC' %then %do;
%let SCREAM = %sysfunc(tranwrd(&SCREAM,'_ABC',''))
%END;
%end;
%checkabc;
what else could be wrong here.....
%macro checkabc;
%if %sysfunc(scan(&SCREAM,-1,_)) eq ABC %then %do;
%let SCREAM = %sysfunc(tranwrd(&SCREAM,_ABC,%str( )));
%END;
%mend;
%let scream=XX_ABC ;
%put before: &scream;
%checkabc
%put after: &scream;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.