I have a macro program which calls screened and screenfailure and it is optional. Below in the datastep i use these for calculating. If i change in the macro call instead of screened as screening and scrn fail instead of screenfailure can i make the datastep also change. I Know it is weird but can there any step where i can do.
if upcase(DSTERM) in ("SCREENING" "SCREENED") then do; %if &TotIncl ne %then %do; &armvar="&TotName"; %end; descr='Patients screened'; sort1=1; sort2=1; n=count; n_pct=.; output; end; %* Screen failure*; if upcase(DSTERM) in ("SCREENING FAILURE" "SCREEN FAILURE") then do; %if &TotIncl ne %then %do; &armvar="&TotName"; %end; descr='Screening failures'; n=count; n_pct=.; sort1=2; sort2=1; output; end;
macro call is
%macro inc( Anl = sdtm.ds, AnlSel = %quote(DSTERM in ("SCREENED" "SCREEN FAILURE")) etc... );
any help
Sas Documentation for call Execute, it is to call macro from a datastep execution.
data xxx;
.....
call execute('%inc(Anl = '||sdtm.ds/*Data step Variable*/||', AnlSel = %quote(DSTERM in ("SCREENED" "SCREEN FAILURE"))');
.....
run;
Your post makes no sense at all. You give a brief definition of a macro called inc which is not used anywhere in the code given. You call macros which you have not given any description.
Second up, why do you even need all these macros and such like, your just overcomplicating things for the purpose of doing it. If you want to do some logic for screened data and some other code for non-screen then this is an if/then scenario e.g:
... if upcase(dsterm) in ("SCREENING","SCREENED") then do; /* Code to do if true */ end; else do; /* Code to do if false */ end; ...
Also DSTERM is a standard variable from the DS domain, why are you needing to upper case it, and check if it is in a list, the values should already be consistent within you SDTM domain - possible even as part of a value list.
You're mixing macro and data step logic and with out the rest of the code or any sort of sample data or a clear question it's going to be really hard to help you.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.