Hi, I'm running the following model:
proc gee data=data descending;
class id category(ref='Non-user') fiscal_yr ;
model outcome(event='1')=category fiscal_yr /dist=bin link=logit type3;
repeated sub=id/within=fiscal_yr;
lsmeans category/ilink oddsratio diff cl;
run;
Category is a numeric variable with a format:
0= 'Non-user'
1='Varied user'
2='User'
I have very specific odds ratios I want to get from the LSMEANS. I want:
Varied vs non-user
User vs non-user
User vs varied
I have tried by changing the reference group in the class statement, which changes the reference in my parameter estimates statement, but not in my "Differences of category Least Squares Means".
Any ideas?
Thank you!
Using REF= in the CLASS statement will set the reference level in both the parameter estimates and the lsmeans difference tables. For example, the statements for a variable, A, with levels 0, 1, and 2
class a(desc ref='0');
lsmeans a / diff;
will give lsmeans differences 1 vs 0 , 2 vs 0, and 2 vs 1.
Using REF= in the CLASS statement will set the reference level in both the parameter estimates and the lsmeans difference tables. For example, the statements for a variable, A, with levels 0, 1, and 2
class a(desc ref='0');
lsmeans a / diff;
will give lsmeans differences 1 vs 0 , 2 vs 0, and 2 vs 1.
Okay! That worked for the logistic. Do you know how to get that to work with a multinomial, same predictor?
The outcome is 0,1,2. I want the reference group to be 1.
So I want the LSMEANS differences table to have the same odds ratios described in the original question, with the outcome being 0 v 1 and 2 v 1.
PROC GEE DATA=test DESCENDING ;
CLASS id testcat(desc ref='0') fiscal_yr;
MODEL ldl_lt100(REF='1')=testcat fiscal_yr /DIST=MULTINOMIAL LINK=GLOGIT TYPE3;
REPEATED SUB=id/WITHIN=fiscal_yr;
LSMEANS testcat/ILINK ODDSRATIO DIFF CL;
RUN;
Currently, it is showing:
ldl_lt100 | testcat | _testcat |
2 | 2 | 1 |
2 | 2 | 0 |
2 | 1 | 0 |
1 | 2 | 1 |
1 | 2 | 0 |
1 | 1 | 0 |
I want:
ldl_lt100 | testcat | _testcat |
2 | 2 | 1 |
2 | 2 | 0 |
2 | 1 | 0 |
0 | 2 | 1 |
0 | 2 | 0 |
0 | 1 | 0 |
The code you show (with response variable option REF='1') gives what you want in SAS release SAS 9.4 TS1M6.
Theoretically, yes! The weird/interesting thing thing is that it does show was I want in an unadjusted model, but as soon as I add other covariates, it doesn't.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.