For an assignment I am trying to get the odds ratios of hpv shots and determining the association of poverty and using region as a confounder
The code I am attempting to use is
proc logistic data = puf.nisteenpuf19;
class cen_reg (param =ref ref= "NORTHEAST")incpov1 (param = ref ref = "ABOVE POVERTY > $75K") ;
model hpvi_group = incpov1 cen_reg incpov1*cen_reg;
run;
However in the output it doesn't give value for any northeast data and i need odds ratios for northeast_below poverty and northeast_above poverty <= $75k. it references all northeast values instead of just referencing northeast_above poverty >75$k
Hope this make sense
Show us the output that you have questions about.
What happens if you include the ODDSRATIO statement in your code?
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_logistic_syntax26.htm
I am not 100% sure how to include it
proc logistic data = puf.nisteenpuf19;
class cen_reg (param =ref ref= "NORTHEAST")incpov1 (param = ref ref = "ABOVE POVERTY > $75K") ;
model hpvi_group = incpov1 cen_reg incpov1*cen_reg;
oddsratio cen_reg incpov1 dif = ref | all;
run;
Was there a problem somewhere? I think it should be:
oddsratio cen_reg*incpov1 dif = all;
Please don't make us keep asking ... when there is a problem in the code, or a problem in the log, or a problem in the output ... show us.
My mistake. I think it should be
oddsratio cen_reg*incpov1/dif = all;
Next step
When you have an error in the log, copy the log as text and paste it into the window that appears when you click on the </>. We need this every time you provide a log for us. This preserves the formatting of the log and makes it more readable.
NOTE: PROCEDURE LOGISTIC used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: The SAS System stopped processing this step because of errors. 2910 proc logistic data = puf.nisteenpuf19; 2911 class cen_reg (param =ref ref= "NORTHEAST")incpov1 (param = ref ref = "ABOVE POVERTY > 2911! $75K") ; 2912 model hpvi_group = incpov1 cen_reg incpov1*cen_reg; 2913 oddsratio cen_reg*incpov1/dif = all; - 22 76 ERROR 22-322: Syntax error, expecting one of the following: ;, /. ERROR 76-322: Syntax error, statement will be ignored. 2914 run;
Sorry, I am very new to this
I also tried using proc genmod but the output zeroed out all of northeast
PROC GENMOD DATA = puf.nisteenpuf19; class CEN_REG (ref = "NORTHEAST") INCPOV1 (REF= "ABOVE POVERTY > $75K"); model HPVI_GROUP = CEN_REG INCPOV1 AGE SEX RACEETHK INCPOV1*CEN_REG/DIST = BINOMIAL LINK = LOG; RUN;
Apparently, ODDSRATIO will not work for interactions, so you should remove it. The default output from PROC LOGISTIC (without the ODDSRATIO statement) should show odds ratios for all model terms. Can you show us that odds ratio output?
This is the output I receive when running pro logistic without the odds ratio statement
proc logistic data = puf.nisteenpuf19; class cen_reg (param =ref ref= "NORTHEAST")incpov1 (param = ref ref = "ABOVE POVERTY > $75K") ; model hpvi_group = incpov1 cen_reg incpov1*cen_reg; run;
Ok. I don't know how to get odds ratios for interactions. The odds ratios for your two main effects are produced by these statements:
oddsratio cen_reg;
oddsratio incpov1;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.