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

Finding the Odds ratio at different levels of chemicals

 

Hello, can someone please help me to find all the odds ratio of different levels of reliability, a1_reliab(1=possible,2=probable, and 3= certain) and concentration, a1_conc (1=low, 2= medium and 3 = high) of individuals exposed to a chemical a1 (0= unexposed and 1= exposed).

The OR is for the association between a chemical a1(exposure of interest) and stomach cancer, the response variable (with cases(ca case) and population controls(pop cont)).

I already calculated the OR between a1 and the stomach cancer using unexposed subjects as a reference, but I would like SAS logistic regression to calculate the ORs at all individual levels(1,2 and 3) for a1_reliab and a1_conc, but it did not; it gave me only ORs at two levels each for

  1. Kindly help me with the code to find all the ORs at the different levels of a1_reliab i.e. OR for possible=?, OR for probable=? and OR for certain=?. Same with a1_conc.

I wouldn’t want SAS to use any of the levels as reference to compute the ORs at each level.

  1. Also is it acceptable to use 2 separate logistic models  for a1_reliab and a1_conc or I can combine the two models into 1 like this:

proc logistic data=chem2;
class a1_reliab (param=ref ref ='1'); a1_conc (param=ref ref ='1');
model lung(event='ca case') = a1_reliab a1_conc; run;

 

Thank you for your expert assistance.

ak.





/* Exposure to chemicals*/
data chem1;
input id$ a1 a1_reliab a1_conc lung$ 14-21;
datalines;
os1 1 3 2 1 ca case
os2 1 1 1 0 ca case
os3 0 2 3 0 pop cont
os4 1 1 1 1 pop cont
os5 0 1 1 0 ca case
os6 0 3 3 0 ca case
os7 1 1 3 1 pop cont
os8 0 2 3 0 ca case
os9 1 2 1 0 pop cont
os10 0 3 1 0 ca case
os11 0 1 2 0 pop cont
os12 0 2 2 0 pop cont
os13 1 1 2 1 pop cont
os14 0 3 3 0 pop cont
os15 1 3 1 1 ca case
os16 0 2 3 0 pop cont
os17 1 1 1 1 pop cont
os18 0 3 2 0 pop cont
os19 0 1 3 0 pop cont
os20 0 3 1 0 pop cont
os21 0 2 1 0 pop cont
os22 1 2 1 0 ca case
;
run;

proc print data=chem1;
title 'Table 1:Sujects exposures to chemicals';
run;


data chem2; set chem1;
if lung in ('ca case','pop cont');
run;

proc format;
value a1_reliab 1='possible' 2='probable' 3='certain';
value a1_conc 1='low' 2='medium' 3='high';

proc logistic data=chem2;
class a1_reliab (param=ref ref ='1');
model lung(event='ca case') = a1_reliab;
title 'Table 2: ORs at different levels of reliability';
run;

proc logistic data=chem2;
class a1_conc (param=ref ref ='1');
model lung(event='ca case') = a1_conc;
title 'Table 3: ORs at different levels of concentration';
run;

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 /* Exposure to chemicals*/
74 data chem1;
75 input id$ a1 a1_reliab a1_conc lung$ 14-21;
76 datalines;
 
NOTE: The data set WORK.CHEM1 has 22 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
 
 
99 ;
100 run;
101
102 proc print data=chem1;
103 title 'Table 1:Sujects exposures to chemicals';
104 run;
 
NOTE: There were 22 observations read from the data set WORK.CHEM1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.26 seconds
cpu time 0.26 seconds
 
 
105
106
107 data chem2; set chem1;
108 if lung in ('ca case','pop cont');
109 run;
 
NOTE: There were 22 observations read from the data set WORK.CHEM1.
NOTE: The data set WORK.CHEM2 has 22 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
 
 
110
111 proc format;
112 value a1_reliab 1='possible' 2='probable' 3='certain';
NOTE: Format A1_RELIAB is already on the library WORK.FORMATS.
NOTE: Format A1_RELIAB has been output.
113 value a1_conc 1='low' 2='medium' 3='high';
NOTE: Format A1_CONC is already on the library WORK.FORMATS.
NOTE: Format A1_CONC has been output.
114
 
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
 
 
115 proc logistic data=chem2;
116 class a1_reliab (param=ref ref ='1');
117 model lung(event='ca case') = a1_reliab;
118 title 'Table 2: ORs at different levels of reliability';
119 run;
 
NOTE: PROC LOGISTIC is modeling the probability that lung='ca case'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: There were 22 observations read from the data set WORK.CHEM2.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.54 seconds
cpu time 0.51 seconds
 
 
120
121 proc logistic data=chem2;
122 class a1_conc (param=ref ref ='1');
123 model lung(event='ca case') = a1_conc;
124 title 'Table 3: ORs at different levels of concentration';
125 run;
 
NOTE: PROC LOGISTIC is modeling the probability that lung='ca case'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: There were 22 observations read from the data set WORK.CHEM2.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.45 seconds
cpu time 0.41 seconds
 
 
126
127 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
139

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

I don't think you are understanding the concept of an odds ratio... it compares the odds of two levels of a predictor. As a ratio, it is the odds of the event for one level divided by the odds of the event for another level. It fundamentally does not apply to one, and only one, level. The code I provided gives the odds ratios among all possible pairs of levels within each predictor. Perhaps you need to rethink exactly what it is you are looking for.

View solution in original post

3 REPLIES 3
StatDave
SAS Super FREQ

Use ODDSRATIO statements. See the PROC LOGISTIC documentation.

 

proc logistic;
class a1_reliab (param=ref ref ='1') a1_conc (param=ref ref ='1');
model lung(event='ca case') = a1_reliab a1_conc; 
oddsratio a1_reliab;
oddsratio a1_conc;
run;
ak2011
Fluorite | Level 6
Thanks Stat for your input. However, SAS still doesn't compute the OR of level 1(possible) for the a1_reliab and level 1(low) for the a1_conc. It used the level 1 as reference which is not what I want.
Could the SAS statement be modified a bit to find the ORs of level 1?
ak.
StatDave
SAS Super FREQ

I don't think you are understanding the concept of an odds ratio... it compares the odds of two levels of a predictor. As a ratio, it is the odds of the event for one level divided by the odds of the event for another level. It fundamentally does not apply to one, and only one, level. The code I provided gives the odds ratios among all possible pairs of levels within each predictor. Perhaps you need to rethink exactly what it is you are looking for.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 630 views
  • 1 like
  • 2 in conversation