02-01-2018 06:56 AM
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... );
02-01-2018 07:15 AM - edited 02-01-2018 07:16 AM
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;
02-01-2018 08:04 AM
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.
02-01-2018 10:56 AM
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.