I have a modified (robust) Poisson model and I need to estimate the effect sizes for each combination of two multi-category variables, x1 and x2. X1 had 28 levels and X2 has 3 levels. Is there an easier, concise way to write the ESTIMATE statement using PROC PLM and some kind of macro? I can keep writing the ESTIMATE statements as below but we will also be collapsing the bins and it is going to be tedious to keep writing it this way. (I am sorry but I do not have sample data to share).
PROC GENMOD;
CLASS x1(ref='0' param=ref) x2 (ref='1' param=ref);
MODEL flag=x1 x2 x1*x2/ DIST=POISSON LINK=LOG;
REPEATED SUBJECTID=id/type=unstr;
ESTIMATE 'X1=1 x2=1' Intercept 1 x1 1
x2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
x1*x2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
ESTIMATE 'x1=2 x2=1' Intercept 1 x1 1
x1*x2
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
ESTIMATE 'x1=3 x2=1' Intercept 1 x1 1
x1*x2
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
ESTIMATE 'x1=4 x2=1' Intercept 1 x1 1
x1*x2
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
ESTIMATE 'x1=5 x2=1' Intercept 1 x1 1
x1*x2
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
..more statements;
RUN;
As I've said here often, you should avoid the difficulty in coding ESTIMATE statements when simpler statements can be used such as the LSMEANS and LSMESTIMATE statements. That is the case here. The LSMEANS statement can give you estimates of all of the X1, X2 combinations: lsmeans x1*x2 / ilink cl;
See the discussion in the "Zou's modified Poisson approach" section of this note that shows an example of a similar analysis to estimate risk ratios (relative risks) comparing levels.
I cannot edit my post so writing again.
The above ESTIMATE statement is not correct and I have missed adding the x2 part in it.
As I've said here often, you should avoid the difficulty in coding ESTIMATE statements when simpler statements can be used such as the LSMEANS and LSMESTIMATE statements. That is the case here. The LSMEANS statement can give you estimates of all of the X1, X2 combinations: lsmeans x1*x2 / ilink cl;
See the discussion in the "Zou's modified Poisson approach" section of this note that shows an example of a similar analysis to estimate risk ratios (relative risks) comparing levels.
I am actually using PROC LOGISTIC. Using LSMEANS gives an error saying that GLM parametrization is needed. I will need to use the same with STRATA statement with PROC LOGISTIC as well. Is there a way to simplify the writing of these multiple ESTIMATE /CONTRAST statements?
In the CLASS statement in PROC LOGISTIC, choose the global option PARAM=GLM.
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_logistic_syntax05.htm
@PamG wrote:
I am actually using PROC LOGISTIC. Using LSMEANS gives an error saying that GLM parametrization is needed. I will need to use the same with STRATA statement with PROC LOGISTIC as well. Is there a way to simplify the writing of these multiple ESTIMATE /CONTRAST statements?
Post Code and Log related to your actual question. Posting code from Proc Genmod and then asking for a solution to Proc Logistic is like putting diesel fuel into a gas engine (or electric ) vehicle. 😲
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.