I'm running PROC GENMOD to do a Poisson regression in SAS Software 9.4 (TS1M8) with SAS/STAT 15.3.
The dependent variable is a 0-1 variable. The MODEL statement has options DIST=POI LINK=LOG.
One of my CLASS variables has four values, 0, 1, 2, 3, with ORDINAL (THERMOMETER) parametrization.
The Class Level Information for that variable (which I'm calling Ordinal_variable here) in the output of PROC GENMOD is
CLASS | Value | Design Variables | ||
Ordinal_variable | 0 | 0 | 0 | 0 |
1 | 1.000 | 0 | 0 | |
2 | 1.000 | 1.000 | 0 | |
3 | 1.000 | 1.000 | 1.000 |
Note that there are other variables (including continuous ones) in my MODEL statement, so I can't just use PROC FREQ to get risk ratios.
I'd like to use ESTIMATE statements (with options /E EXP) to get risk ratios for the comparisons between successive levels of the ordinal class variable (that is, risk ratios of the dependent variable for Ordinal_variable equaling 1 vs 0, 2 vs 1, and 3 vs 2).
My question: I can't figure out how what the arguments for the ESTIMATE statement should be.
(NOTE: I already know how to use reference parametrization and ESTIMATE statements to get risk ratios for 1 vs 0, 2 vs 0, and 3 vs 0 -- have the parametrization for that variable in the CLASS statement be ORDER=INTERNAL DESC PARAM=REF and then use three estimate statements, ESTIMATE that_variable 0 0 1 /E EXP; ESTIMATE that_variable 0 1 0 /E EXP; ESTIMATE that_variable 1 0 0 /E EXP;
What I'd like to do here, though, is take advantage of the ordinal nature of my predictor to get risk ratios for the successive steps.)
Your response is binary, not a count, so a logistic model would typically be used rather than a Poisson model. PROC LOGISTIC will give you odds ratio estimates, but if you specifically want relative risks (risk ratios), then you can use the NLMeans macro or one of the other methods shown in this note. Typically the most intuitive comparative measure is the risk difference which can also be provided by the NLMeans macro as shown in this note.
The first link I provided in my post shows the Poisson method using PROC GENMOD that you're talking about. In the example there, the CLASS predictor of interest is treated as nominal and in that case, the easiest way to get risk ratios is using GLM parameterization and the LSMEANS statement as shown rather than to mess with ESTIMATE statements.
In your case using the ORDINAL parameterization, the parameters of the variable are interpreted as the incremental change resulting from increasing the variable from the previous level to each level in turn. So, the relative risk associated with each level change is just the parameter exponentiated. Using the neuralgia data in the example titled "Logistic Modeling with Categorical Predictors" in the PROC LOGISTIC documentation, these statements create an ordinal CLASS variable, DURATION, fit the Poisson model with it using ORDINAL parameterization, and use ESTIMATE statements to produce the relative risks which appear in the Mean columns.
proc rank data=neuralgia groups=4 out=neur; var duration; run;
data neur; set neur; id=_n_; painnum=(pain="Yes"); run;
proc genmod data=neur;
class Treatment Sex duration(param=ordinal) id / param=ref;
model painnum= Treatment Sex Age Duration / d=p;
repeated subject=id;
estimate 'rr 0-1' duration 1 0 0;
estimate 'rr 1-2' duration 0 1 0;
estimate 'rr 2-3' duration 0 0 1;
run;
But since the risk ratios you want are just comparisons among particular pairs of levels, the equivalent can be done without the ordinal parameterization using the easier LSMEANS method shown in the example in the note.
proc sort data=neur; by descending duration; run;
proc genmod data=Neur;
class Treatment Sex id duration(order=data);
model painnum= Treatment Sex Age Duration / d=p;
repeated subject=id;
lsmeans duration / diff exp cl;
run;
This is helpful, and in fact it gets me closer to where I want to be because it links in turn to 24447 - Examples of writing CONTRAST and ESTIMATE statements (sas.com).
Now, what I'd like to see is something just like the examples of the ESTIMATE statement in Usage Note 24447 but with ORDINAL parametrization of a CLASS variable. (The examples in 24447 use either effects or reference parametrization.) What I'm not entirely clear on is how the ORDINAL parametrization maps to the coefficients for the effects in the ESTIMATE statement.
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.