BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PamG
Quartz | Level 8

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;
1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

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.

View solution in original post

5 REPLIES 5
PamG
Quartz | Level 8

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.

StatDave
SAS Super FREQ

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.

PamG
Quartz | Level 8

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?

ballardw
Super User

@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.  😲

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 5 replies
  • 688 views
  • 3 likes
  • 4 in conversation