Here is the code where I define the period.
%macro run_report; %do period = 1 %to 4; * begin reporting loop;
* date calc adjustment; %if &period = 1 %then %do; %let adj=0; %end;
%if &period = 2 %then %do; %let adj=1; %end;
%if &period = 3 %then %do; %let adj=2; %end;
%if &period = 4 %then %do; %let adj=3; %end;
* create date params;
data _null_; format dt date9.; dt = intnx('qtr', today(), - %eval(1 + &adj.), 'end'); call symput('dt',put(dt, date9.)); run;
data _null_; format newstart date9.; newstart = intnx('qtr', today(), - %eval(1 + &adj.), 'begin'); call symput('newstart',put(newstart, date9.)); run;
data _null_; format tempd yymmdd10.; tempd = intnx('qtr', today(), - %eval(2 + &adj.), 'begin'); pdstart=put(tempd,yymmdd10.)||' '||'00:00:00'; call symput('pdstart',pdstart); run;
data _null_; tempd = intnx('qtr', today(), - %eval(1 + &adj.), 'end'); pdend=put(tempd,yymmdd10.)||' '||'00:00:00'; call symput('pdend',pdend); run;
/*pdstart_1 and pdend_1*/ data _null_; format tempd mmddyys10.; tempd = intnx('qtr', today(), - %eval(2 + &adj.), 'begin'); pdstart_1=put(tempd,mmddyys10.); call symput('pdstart_1',pdstart_1); run;
data _null_; tempd = intnx('qtr', today(), - %eval(1 + &adj.), 'end'); pdend_1=put(tempd,mmddyys10.); call symput('pdend_1',pdend_1); run;
data _null_; format priordt date9.; priordt = intnx('qtr', today(), - %eval(2 + &adj.), 'end'); call symput('priordt',put(priordt, date9.)); run;
data _null_; tempd = intnx('qtr', today(), - %eval(3 + &adj.), 'begin'); priorpdstart=put(tempd,yymmdd10.)||' '||'00:00:00'; call symput('priorpdstart',priorpdstart); run;
data _null_; tempd = intnx('qtr', today(), - %eval(2 + &adj.), 'end'); priorpdend=put(tempd,yymmdd10.)||' '||'00:00:00'; call symput('priorpdend',priorpdend); run;
data _null_; format tempd yymmdd10.; tempd = intnx('qtr', today(), - %eval(4 + &adj.), 'begin'); naloxonepdstart=put(tempd,yymmdd10.)||' '||'00:00:00'; call symput('naloxonepdstart',naloxonepdstart); run;
data _null_; tempd = intnx('qtr', today(), - %eval(1 + &adj.), 'end'); format tempd yymmdd10.; naloxonepdend=put(tempd,yymmdd10.)||' '||'00:00:00'; call symput('naloxonepdend',naloxonepdend); run;
%put PERIOD: .
%put &dt; %put &newstart; %put &pdstart; %put &pdend; %put &pdstart_1; %put &pdend_1; %put &priordt; %put &priorpdstart; %put &priorpdend; %put &naloxonepdstart; %put &naloxonepdend;
Here is all the errors:
WARNING: Apparent symbolic reference PERIOD not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &period=NUM ERROR: The macro SECTION5 will stop executing. WARNING: Apparent symbolic reference PERIOD not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &period=NUM ERROR: The macro SECTION5 will stop executing. WARNING: Apparent symbolic reference PERIOD not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &period=NUM ERROR: The macro SECTION5 will stop executing. WARNING: Apparent symbolic reference PERIOD not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &period=NUM ERROR: The macro SECTION5 will stop executing.
... View more