So I am running into some issues here: Following is the macro I am running to estimate the rate per 1000. The PROC GENMOD is running without any issue, however, in the second part where I am trying to access the same variable and perform some arithmetic operation, it is throwing the following error: " Statement is not valid or it is used out of proper order" Wondering it has to do with accessing the macro variable and corresponding numeric value from the dataset internally. But not quite getting the coding right. Any feedback or suggestion is appreciated! Thanks! %macro rate1(dat,vars);
%do i = 1 %to %sysfunc(countw(&vars.));
%put %scan(&vars., &i.);
%LET newv=%scan(&vars., &i.);
data new_Results;
set &dat.;
proc genmod data=&dat.;
model %scan(&vars., &i.) = / offset=ln dist=poisson lrci;
estimate 'Mean' intercept 1;
title " cases for in &newv";
run;
proc print data=new_Results;
id n %scan(&vars., &i.);
inputval=INPUT(SYMGET(%scan(&vars., &i.));
IR=inputval/n;
IR_1K=IR*1000;
LC=quantile('chisq',0.025, inputval*2)/(n*2);
UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
res_l=LC*1000;
res_u=UC*1000;
title "rate per 1K another way";
run;
%END;
%mend rate1;
%run_pr(x_trans,c_tot);
... View more