BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lauragrau
Calcite | Level 5

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

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. 

View solution in original post

4 REPLIES 4
StatDave
SAS Super FREQ

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. 

lauragrau
Calcite | Level 5

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_lt100testcat_testcat
221
220
210
121
120
110

 

I want:

ldl_lt100testcat_testcat
221
220
210
021
020
010
StatDave
SAS Super FREQ

The code you show (with response variable option REF='1') gives what you want in SAS release SAS 9.4 TS1M6. 

lauragrau
Calcite | Level 5

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. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4 replies
  • 1527 views
  • 0 likes
  • 2 in conversation