01-21-2016 02:09 PM
data have; input group $ subgp $ a b c; datalines; s amy 71130 12739 11243 s brivy 14144 2548 2214 s vor 81841 6538 5820 s dce 68065 3775 3288 ase am 79199 20314 17987 bse bf 55981 5286 4578 g as2 703236 16685 14776 g bs5 6337 6747 5918 g co5 8607 2186 1881 ; data want; set have; d=a-c; run; proc transpose data=want out=notc prefix=group; by group; id subgp; var d; run; proc print data=notc; run;
I have several groups. Each group has two or over two outcomes. I want to use proc freq to calculate relative risk.
My orginal data has two variables listed above. I need to have a new variable, d, that is, d=a-c
then, i put d and c into the following code (b is not needed). I wonder whether there is a way, whether I can use transpose to make it more efficiently. and always, use first one of the subgroup (subgrp) as a reference, rr=1
input subgrp $ Response $ Count;
brivy Yes 2240
brivy No 11930
amy Yes 11243
amy No 2214
proc freq data=question order=data;
tables subgrp*Response / relrisk;
01-21-2016 03:20 PM
Proc freq won't calculate relative risk with more than 2 groups. As indicated, I'm not sure your actually using the relative risk measure correctly, because you don't have a case/control situation. If you have an observational study you should be using odds ratio instead.
01-21-2016 03:41 PM
I need to have each 2X2 tables, with the first one as the reference.
For each new table I generate, it is a kind of case control