BookmarkSubscribeRSS Feed
ak2011
Fluorite | Level 6

Hello,

1. I am creating 2 different groups; refgroupA and refgroup B.I have been able to create refgroupA but I would need assistance for refgroup B. Refgroup B in the results(attached) is incorrect.

 

There are 3 agents (a1exp,a2exp and a3exp), their levels and categories of exposures. 0=unexposed, 1 is exposed with levels 1=high and 2=low.

Refgroup A are ids(cases and controls(cont) not exposed to agent 1(a1exp): ie. a single reference group used for the evaluated agents (a2exp and a3exp).

Refgroup B are ids exposed to agent 1(a1exp) but not to agent under analysis ie. a2exp and a3exp.[Actually there are many agents but I am using only 3 of them as a test].

The idea of these refgroups is to check of the ORs are lower when using refgroup A in the analysis, in comparison with ORs obtained with regroup B.

refgroupB created is not right because ids exposed to a1exp not a2exp are os2, os6 and os12;

Ids exposed to a1exp not a3exp are os4,os6 and os13. Help needed here, please for the refgroupB.

2. Help also needed when using refgroupA and refgroupB in analysis to be able to fill in   the OR table (Table 3) attached.

 

? After creating the refgroups, do I have to merge the regroup results with original data(expinfo) to be able to fill in the table? I have no clue. Please help.

Thanks. ak.


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 a3exp 46-47 a3exp_level$ 48-50 a3exp_cat 59-60
lung$ 68-72;
datalines;
os1 0 unexposed 0 1 high 1 0 unexposed 0 case
os2 1 low 2 0 unexposed 0 1 low 2 case
os3 0 unexposed 0 0 unexposed 0 0 unexposed 0 case
os4 1 high 1 1 low 2 0 unexposed 0 cont
os5 0 unexposed 0 0 unexposed 0 1 high 1 cont
os6 1 low 2 0 unexposed 0 0 unexposed 0 case
os7 1 low 2 1 high 1 1 low 2 case
os8 0 unexposed 0 0 unexposed 0 0 unexposed 0 case
os9 0 unexposed 0 0 unexposed 0 0 unexposed 0 cont
os10 1 high 1 1 low 2 1 low 2 cont
os11 0 unexposed 0 0 unexposed 0 1 high 1 case
os12 1 low 2 0 unexposed 0 1 high 1 case
os13 1 high 1 1 low 2 0 unexposed 0 case
os14 0 unexposed 0 0 unexposed 0 0 unexposed 0 cont
os15 0 unexposed 0 0 unexposed 0 0 unexposed 0 cont
os16 1 high 1 1 low 2 1 high 1 cont
os17 0 unexposed 0 1 high 1 1 low 2 cont
os18 0 unexposed 0 0 unexposed 0 0 unexposed 0 cont
;
run;



proc freq data=expinfo; where a1exp=0;
tables lung;
title 'Table 1:Subjects unexposed to a1exp';
run;

proc sql;
create table t as
select
id, a1exp, a2exp,a3exp,lung,
a1exp=0 as refgroupA,

a1exp ne 0 and a2exp=0 and a1exp ne 0 and a3exp=0 as refgroupB

from expinfo
;
quit;

proc print data=t;
title 'Table 2: original variables and refgroupA and refgroupB;
refgroupB is not correct';
run;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73
74 data expinfo;
75 input id$ 1-4 a1exp 6-7 a1exp_level$ 8-17 a1exp_cat 19-20
76 a2exp 26-27 a2exp_level$ 28-32 a2exp_cat 39-40 a3exp 46-47 a3exp_level$ 48-50 a3exp_cat 59-60
77 lung$ 68-72;
78 datalines;
 
NOTE: The data set WORK.EXPINFO has 18 observations and 11 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
 
 
97 ;
98 run;
99
100
101
102 proc freq data=expinfo; where a1exp=0;
103 tables lung;
104 title 'Table 1:Subjects unexposed to a1exp';
105 run;
 
NOTE: There were 10 observations read from the data set WORK.EXPINFO.
WHERE a1exp=0;
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.26 seconds
cpu time 0.25 seconds
 
 
106
107 proc sql;
108 create table t as
109 select
110 id, a1exp, a2exp,a3exp,lung,
111 a1exp=0 as refgroupA,
112
113 a1exp ne 0 and a2exp=0 and a1exp ne 0 and a3exp=0 as refgroupB
114
115 from expinfo
116 ;
NOTE: Table WORK.T created, with 18 rows and 7 columns.
 
117 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
 
 
118
119 proc print data=t;
120 title 'Table 2: original variables and refgroupA and refgroupB;
121 refgroupB is not correct';
122 run;
 
NOTE: There were 18 observations read from the data set WORK.T.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.35 seconds
cpu time 0.35 seconds
 
 
123
124 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
136

 



 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 0 replies
  • 422 views
  • 0 likes
  • 1 in conversation