%HR(x=Treatment_Year);
%HR(ace_arb);
Looking at your code closely, you can see the macro calls that work are formatted differently from the macro calls that do not, specifically you're missing the X= portion.
@Denali wrote:
Hi,
I was trying to conduct Cox proportional hazard model using below macro. However, it stopped and gave me error messages " ERROR: More positional parameters found than defined." for the last 6 variables.
%HR(ace_arb); %HR(ccb); %HR(asa); %HR(statin); %HR(bb); %HR(Stage);
Below is my SAS macro code:
libname out xlsx "H:\Data\HR_Categorical_RS.xlsx"; %macro HR(x=); %let outputName=_PE%substr(%cmpres(&x.),1,%sysfunc(min(%length(&x.),29))); ods graphics off; ods output ParameterEstimates=&outputName.;
proc phreg data = RS1; class &x; model CTOX53cox_interval_1_6_21*CTOX53__within_1_year_of_trastuz(0) = &x /rl; run;
ods output close; ods graphics on;
%mend HR;
%HR(x=Age_C); %HR(x=BMI_C ); %HR(x=Anthracycline__current_or_prior_); %HR(x=XRT); %HR(x=ER_cat); %HR(x=htn); %HR(x=dm); %HR(x=hl); %HR(x=cad); %HR(x=arrhythmia__AY_adjudicated_1_202); %HR(x=Smoking); %HR(x=LVEF_C); %HR(x=Race); %HR(x=PR); %HR(x=Treatment_Year); %HR(ace_arb); %HR(ccb); %HR(asa); %HR(statin); %HR(bb); %HR(Stage);
Below is the log:
2705 %HR(x=Race);
NOTE: Convergence criterion (GCONV=1E-8) satisfied. NOTE: The data set WORK._PERACE has 2 observations and 11 variables. NOTE: PROCEDURE PHREG used (Total process time): real time 0.03 seconds cpu time 0.04 seconds
2706 %HR(x=PR);
NOTE: 1 observations were deleted due either to missing or invalid values for the time, censoring, frequency or explanatory variables or to invalid operations in generating the values for some of the explanatory variables. NOTE: Convergence criterion (GCONV=1E-8) satisfied. NOTE: The data set WORK._PEPR has 1 observations and 11 variables. NOTE: PROCEDURE PHREG used (Total process time): real time 0.03 seconds cpu time 0.03 seconds
2707 %HR(x=Treatment_Year);
NOTE: Convergence criterion (GCONV=1E-8) satisfied. NOTE: The data set WORK._PETREATMENT_YEAR has 4 observations and 11 variables. NOTE: PROCEDURE PHREG used (Total process time): real time 0.04 seconds cpu time 0.03 seconds
ERROR: More positional parameters found than defined. ERROR: More positional parameters found than defined. 2708 %HR(ace_arb); ERROR: More positional parameters found than defined. 2709 %HR(ccb); ERROR: More positional parameters found than defined. 2710 %HR(asa); ERROR: More positional parameters found than defined. 2711 %HR(statin); ERROR: More positional parameters found than defined. 2712 %HR(bb); ERROR: More positional parameters found than defined. 2713 %HR(Stage);
Could you please help me with trouble shooting my code? Thank you!
... View more