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;
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.
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.