SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
asgee
Obsidian | Level 7

Hi all,

 

This sounds like a very basic problem but I'm running a logistic model where my outcome is binary (yes / no), and my main predictor is continuous. I've modified my variables and code below:

 

proc logistic data=imputed_50; 
   class p1 (ref='0') dev (ref='0') euro (ref='1') incom (ref='4') / param=ref; 
   model p1 (event='1')= fer euro dev incom 
                  / covb clodds=wald orpvalue;  
	by _Imputation_;
	ods output ParameterEstimates=Lgsparms; 
run;

The variable "fer" is a continuous variable that has values going from 0 to 150. When I run the model, I get Odds Ratios which would be interpreted for example as:

"For every 1 unit increase of (fer), there is a 40% increase in the odds of attaining (p1)."

 

My understanding is that the default sorting order when running proc logistic on continuous variables is "Ascending" if I'm not mistaken.

 

I want to know if it would be possible to reverse this in model, such that the (fer) variable is descending, where the values are interpreted as "For every 1 unit decrease of (fer)...". I understand doing this would only change the values such that everything will be the opposite. I'm aware there's a descending option but not sure if I can just specify that for the (fer) variable and leave everything else the same. 

 

Any help would be appreciated! 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Create a new variable ifer = - fer; and use that in the model.

PG

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

My understanding is that the default sorting order when running proc logistic on continuous variables is "Ascending" if I'm not mistaken.

Well, I would not phrase it that way. Numerical variables are not "sorted" in my understanding of the word. 150 is always greater than 0, no matter how you want to phrase it.

 

Nevertheless, the answer to your question is simple math. If a 1 unit increase in Fer results in a 40% increase in the log odds ratio, then a 1 unit decrease in FER results in a 1 - (1/1.4) (or 28.6%) decrease in the log odds ratio.

 

 

 

 

--
Paige Miller
PGStats
Opal | Level 21

Create a new variable ifer = - fer; and use that in the model.

PG
asgee
Obsidian | Level 7
Hi @PGStats ! Thanks for your reply, yes it seems like your code does work. I just have a follow-up question though, since my model is based on an imputed dataset, should I include the (ifer) variable instead of the normal (fer) variable in creating that imputed dataset?

PGStats
Opal | Level 21

You don't need to change your imputing procedure. You don't even need to create an intermediate dataset. You should create the variable iFer with a programming statement within proc glimmix, before the model statement.

PG
asgee
Obsidian | Level 7
Hi @PGStats ! Ah okay, that makes sense! I just have one last follow-up question regarding that. In my imputing procedure I included an a-priori interaction term that I want to asses (ex. gender*fer). However in the modelling, you mentioned that I should instead change the (fer) variable to the (ifer). Should I have also created a new interaction term where it's (gender*ifer) instead in my modelling (not in the imputing procedure)?

PGStats
Opal | Level 21

I don't see why you should be imputing interaction terms. But I might be missing something here. You might try posting this question as a new topic in the Statistical Procedures forum.

PG
asgee
Obsidian | Level 7
Ah sounds good, ty again!

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2173 views
  • 6 likes
  • 3 in conversation