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

 

Currently, I am not receiving the appropriate Odds Ratio and Relative Risks table in my SAS below when using the ameshousing3.sas7bdat dataset. The expectation is that SAS produces the table in the Results Viewer. However, that is not happening in my use case. Does anyone know what I am doing wrong? I have attached the SAS dataset to this question along with a screenshot of the output that I am receiving. 

 

sample_output.PNG

 

PROC FREQ DATA = WORK.ameshousing3;
	TABLES fireplaces * bonus / CHISQ RELRISK NOROW NOCOL NOPERCENT;
	FORMAT bonus bonusfmt.;
	TITLE "Association Analysis - Chi-Sq and Odds Ratio";
RUN;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
tarheel13
Rhodochrosite | Level 12

You can also get odds ratio from proc logistic. 

ods graphics on ;
proc logistic data=stat1.ameshousing3 plots(only)=(effect oddsratio (type=horizontalstat));
	model bonus(event="1") = fireplaces / clodds=both;
run;
ods graphics off;
 

View solution in original post

6 REPLIES 6
Watts
SAS Employee

The odds ratio and relative risks are provided for 2x2 tables (tables that contain two rows and two columns). It looks like your table is 3x2. 

Vicente95
Obsidian | Level 7

Ok, thank you for the response. How can I fix it? 

Watts
SAS Employee

You can decide what are the objectives, what are the appropriate analyses, what do you need to compute, and so on.

https://sciencing.com/calculate-odds-ratio-contingency-table-8782587.html 

 

tarheel13
Rhodochrosite | Level 12

You can also get odds ratio from proc logistic. 

ods graphics on ;
proc logistic data=stat1.ameshousing3 plots(only)=(effect oddsratio (type=horizontalstat));
	model bonus(event="1") = fireplaces / clodds=both;
run;
ods graphics off;
 
Vicente95
Obsidian | Level 7

Oh wow! Thank you for letting me know. On the same topic of PROC LOGISTIC, how can I fit a binary logistic regression model with bonus as the outcome variable and basement_area, fireplaces, and lot_shape2 as the predictor variables? In this model, I want to specify "Regular" as the reference group for the lot_shape_2 variable and "0" as the reference level for the fireplaces variable.

 

Would it look something like this?

 

PROC LOGISTIC DATA = WORK.ameshousing3
	PLOTS(ONLY) = (EFFECT (CLBAND X = (FIREPLACES)) ODDSRATIO (TYPE = HORIZONTALSTAT));
	CLASS lot_shape_2 (PARAM = REF REF = 'Regular') fireplaces (PARAM = REF REF = '0');
	MLogit1: MODEL bonus(event='1') = basement_area lot_shape_2 fireplaces / clodds=pl;
	UNITS fireplaces=1;
	ODDSRATIO 'Comparisons of Type' lot_shape_2 / DIFF=ALL CL=PL;
	TITLE 'Bonus Eligibility Status Model';
RUN;
tarheel13
Rhodochrosite | Level 12

Looks right.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 6 replies
  • 3105 views
  • 4 likes
  • 3 in conversation