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

I want to check the OR of some independent variables in a logistic model.

I used this model :

 

proc logistic data=results2 descending;
where season between 1001 and 3254;
class
source_revenu_cat (param=ref ref='Aucune')
betail (param=ref ref='auc')
terres_acces (param=ref ref='Non')
region (param=ref ref='1-Sud')
v_urban_rural (param=ref ref='rural')
etudes_ppt_cat (param=ref ref="A - Jamais allée à l'école")
personnes_menage_nombre1 (param=ref ref='1 à 3')
adultes_15_ans_plus (param=ref ref='1 ou plus');
model MDD_W_5 (event='Oui')= region v_urban_rural adultes_15_ans_plus source_revenu_cat terres_acces betail etudes_ppt_cat

personnes_menage_nombre1 ;

format season saison.;
run;

 

The table of the OR gave me this result; though the percentages don't seem to match !! did I do something wrong with the code or the interpretation ??

image.png

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@sebai wrote:

 

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?


I think your assumption here is incorrect, you can review how Odds Ratio are calculated here

 

And your output is clearly not the default SAS output, so it's been manipulated somehow already. Check your actual results from the PROC LOGISTIC and you'll see that the output does not include the Odds Ratio of 1 or an estimate for the reference levels. By default there is no estimate for the reference level, but you're setting it to 1 as the reference level somewhere, which is technically correct. The reference level is assumed to be at 1, since by default the comparisons are to the reference level for categorical data.

 

You set terres_access to have the reference level be NO. 

 

terres_acces (param=ref ref='Non')

PS. You do note need to set PARAM=REF for every variable you can include it at the end instead and it applies to all variables. If you have different parameterization methods for variables then you would need to set it individually.

 

class <list of variables and reference levels> / param=ref;

View solution in original post

4 REPLIES 4
Reeza
Super User

What do you mean 'the percentages don't match'?  

 

I suspect you may have lost some observations due to missing data in the other variables, you can see this by looking at the top of the results and checking how many observations were used in the model. 

 


@sebai wrote:

I want to check the OR of some independent variables in a logistic model.

I used this model :

 

proc logistic data=results2 descending;
where season between 1001 and 3254;
class
source_revenu_cat (param=ref ref='Aucune')
betail (param=ref ref='auc')
terres_acces (param=ref ref='Non')
region (param=ref ref='1-Sud')
v_urban_rural (param=ref ref='rural')
etudes_ppt_cat (param=ref ref="A - Jamais allée à l'école")
personnes_menage_nombre1 (param=ref ref='1 à 3')
adultes_15_ans_plus (param=ref ref='1 ou plus');
model MDD_W_5 (event='Oui')= region v_urban_rural adultes_15_ans_plus source_revenu_cat terres_acces betail etudes_ppt_cat

personnes_menage_nombre1 ;

format season saison.;
run;

 

The table of the OR gave me this result; though the percentages don't seem to match !! did I do something wrong with the code or the interpretation ??

image.png


 

sebai
Obsidian | Level 7

Actually, all my observations were used I have no missing data.

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?

Reeza
Super User

@sebai wrote:

 

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?


I think your assumption here is incorrect, you can review how Odds Ratio are calculated here

 

And your output is clearly not the default SAS output, so it's been manipulated somehow already. Check your actual results from the PROC LOGISTIC and you'll see that the output does not include the Odds Ratio of 1 or an estimate for the reference levels. By default there is no estimate for the reference level, but you're setting it to 1 as the reference level somewhere, which is technically correct. The reference level is assumed to be at 1, since by default the comparisons are to the reference level for categorical data.

 

You set terres_access to have the reference level be NO. 

 

terres_acces (param=ref ref='Non')

PS. You do note need to set PARAM=REF for every variable you can include it at the end instead and it applies to all variables. If you have different parameterization methods for variables then you would need to set it individually.

 

class <list of variables and reference levels> / param=ref;
ballardw
Super User

@sebai wrote:

Actually, all my observations were used I have no missing data.

By the percentages don't match: I mean that because 24% is higher than 19.1% then the OR should be more than 1, right !!?


You are describing a Prevalence Ratio.

Another link that may help: https://www.researchgate.net/post/Prevalence_Ratio_Odds_Ratio_and_Relative_Risk

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 784 views
  • 6 likes
  • 3 in conversation