BookmarkSubscribeRSS Feed
slegleye
Fluorite | Level 6

Hello everyone.

 

I try to compute OR and 95%CI for OR for a binary variable X interacting with a continuous variable TIME (in the product X*Time) for some values of Time=t in PROC SURVEYLOGISTIC. I have SAS 9.4 TS, Level 1M5.

 

Here is the code :

proc surveylogistic data=work;
cluster username ;
class X /param=glm;
model attrition(ref='0')=X TIME X*TIME / varadjust=morel expb rsq ;
run ;

 

There is an option in PROC LOGISTIC, but I cannot find any way for doing the same in PROC SURVEYLOGISTIC.

 

Any suggestion is welcome !

5 REPLIES 5
Rick_SAS
SAS Super FREQ

I think you are looking for the CLODDS option on the MODEL statement.

Formulas/explanation

 

slegleye
Fluorite | Level 6

Thank you, Rick.

In fact I want to compute OR for a time-varying variable, at certain time points: I do time-discrete logistic regression, TIME is continuous and X is binary and time-varying.

The database WORK is in person-year format : each individual in my panel (experiment) is observed (ATTRITION=0) until he/she is excluded (ATTRITION=1). For an individual who is observed n-1 times, ATTRITION has value 0 the first n-1 lines and ATTRITION has value 1 the last line at time=n when he/she is excluded. PERSONYEAR has value n-1 for this individual.

If I use simply PROC LOGISTIC, I can use the ODDSRATIO statement :

PROC LOGISTIC data=work ;
class X/param=glm ;
Model attrition(ref='0')=TIME X TIME*X PERSONYEAR ;
ODDSRATIO X /AT (PERSONYEAR=1 18 36) ;
RUN ;

The problem is that using proc logistic provides underestimated standard errors of the OR. Using PROC SURVEYLOGISTIC with the statement CLUSTER ID (ID being the identification number of the individuals) provides correct standard errors. But it seems there is no similar statement in PROC SURVEYLOGISTIC.

In PROC SURVEYLOGISTIC, it seems that the option CLODDS cannot be used with AT suboption. Or maybe I am wrong ?

Best,

Rick_SAS
SAS Super FREQ

I see. In that case, I think you want to use the LSMEANS and SLICE statements, as described in the first example in @SAS_Rob Agnelli (2014), which seems similar to your design.

 

Be sure to use the GLM parameterization, as you are already doing. The LSMEANS statement supports the ODDSRATIO and CL option, and the SLICE statement enables you to specify the X values at which you want to estimate the odds ratio.

 

slegleye
Fluorite | Level 6

Hello Rick, hello everybody.

 

Thank you again.

 

You picked up the right example in the paper by Agnelli (2014): I also read it. It concerns categorical variables and unfortunately, it does not work for continuous variables...

 

In my case, with X*TIME, TIME being continuous and X binary, and the statement "lsmeans X*TIME/oddsratio cl diff;", I get an error message : "ERROR: Only CLASS variables allowed in this effect".

 

Any other suggestion ?

 

 

ChuksManuel
Pyrite | Level 9

Hello, 

DId you finally solve this problem?

 I have a similar problem of interaction between a categorical and a continuous variable using proc surveylogistic and i could not figure it out.Let me know how you solved it.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 2602 views
  • 0 likes
  • 3 in conversation