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.
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;
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;
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.
Ok, thank you for the response. How can I fix it?
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
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;
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;
Looks right.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.