Hello,
I would appreciate if someone could help me with the SAS code in logistic regression to find the estimate log odds/odds ratio of a comparison/reference group (refgroup) above. I have the same refgroup for the 2 agents(a1exp and a2exp).
I used a similar approach to the solution to my previous question that I posted on the forum and which was answered by someone. I am posting another question quite different from what I posted before.
Unexposed = 0, exposure levels: 1= high and 2=low.
Thanks in advance.
ak.
Main focus: Refgroup column; how to compute the ORs using logistic regression.
Reference group(refgroup) is composed of subjects (ids) not exposed to either of the agents(a1exp or a2exp). 2 ca cases (cases) and 6 pop cont(controls) met the criterion.
Please find below my code and log. Results are attached(Table 5: Exposure levels).
data expinfo;
input id$ 1-4 a1exp 6-7 a1exp_level$ 8-17 a1exp_cat 19-20
a2exp 26-27 a2exp_level$ 28-32 a2exp_cat 39-40 lung$ 48-55;
datalines;
os1 0 unexposed 0 1 high 1 ca case
os2 1 low 2 0 unexposed 0 ca case
os3 0 unexposed 0 0 unexposed 0 pop cont
os4 1 high 1 1 low 2 pop cont
os5 0 unexposed 0 0 unexposed 0 pop cont
os6 1 low 2 0 unexposed 0 ca case
os7 1 low 2 1 high 1 ca case
os8 0 unexposed 0 0 unexposed 0 ca case
os9 0 unexposed 0 0 unexposed 0 pop cont
os10 1 high 1 1 low 2 pop cont
os11 0 unexposed 0 0 unexposed 0 ca case
os12 1 low 2 0 unexposed 0 ca case
os13 1 high 1 1 low 2 ca case
os14 0 unexposed 0 0 unexposed 0 pop cont
os15 0 unexposed 0 0 unexposed 0 pop cont
os16 1 high 1 1 low 2 pop cont
os17 0 unexposed 0 1 high 1 pop cont
os18 0 unexposed 0 0 unexposed 0 pop cont
;
run;
/*proc print data=expinfo;
Title 'Table 1: Exposure of ids to 2 agents';*/
/*Step 1: Finding number of cases and controls unexposed to agents(a1,a2,a3 and a4)*/
proc freq data=expinfo(where=(sum(a1exp,a2exp)=0));
tables lung;
title 'Table 1:Subjects unexposed to either of the 2 agents';
run;
/*Step 2:Using subjects unexposed to any of agents as a ref. group*/
proc sql;
create table t as
select
id, a1exp, a2exp,lung,
sum(a1exp,a2exp)=0 as refgroup
from expinfo
;
quit;
proc print data=t;
title 'Table 2a: original variables and ref group';
run;
proc freq data=t;
tables lung* refgroup;
title 'Table 2b: freq of ca case and pop cont for ref group';
run;
proc freq data=expinfo;
tables lung* a1exp_level lung*a1exp_cat
lung* a2exp_level lung*a2exp_cat ;
title 'Table 3: freq of ca case and pop cont for vs lung';
run;
data logtest; set t;
if lung in ('ca case','pop cont');
run;
proc logistic data=logtest;
model lung(event='ca case') =refgroup;
Title 'Table 4: Estimates for ref. group';
run;
I think the OP cross-posted this message. This entry in the Statistical Community looks the same:
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.