SAS MACRO FOR CUMULATIVE INCIDENCE
Usage:
incid(dsn,group,cause1,cause2,time,out=outdsn)
Where
dsn ----
the data set name with the data
group--- the group number. Groups are
numbered sequential from 1,...,G
cause1-- The indicator of a cause 1 event
(1-Yes, 0-no)
cause2-- The indicator of a cause 2 event (1-Yes,
0-no)
time---- The time to
occurence of cause 1 or 2 or censoring (whichever is first)
outdsn-- Name of an output data set
name
Output:
A SAS data set "outdsn: is created and printed with the
following data:
Time---- On study time
Group--- Group
number
CI1----- Estimated
Cumulative Incidence for 1st cause
SE_CI1-- Estimated Standard Error for
1st cause
CI2----- Estimated Cumulative Incidence for 1s2
cause
SE_CI2-- Estimated Standard Error for 1s2 cause
Example:
%include 'incidence';
/* incidence is the
file name with the macro */
data one;
input group time type ;
/* type has value 1 if cause 1, 2 if
cause 2, 0 if censored*/
if type=1 then cause1=1; else cause1=0;
if type=2 then
cause2=1; else cause2=0;
cards;
1 1
2
1 2 1
1
3 0
1 4
1
1 1.5 2
1 .5 2
1
2.5 1
1 2.9 1
1 3
1
2 1.3 2
2 5
1
2 3.8 0
2 4
1
2 1.6 2
2 0.9 2
2 2.5 1
2 2.9 2
2 3.4 1
run;
%incid(one,group,cause1,cause2,time,out=two);
proc print data=two;
OUTPUT
Obs
time group CI1 SE_CI1 CI2 SE_CI2
1 0.5 1 0.00000 0.00000 0.11111 0.09877
2 0.9 1
0.00000 0.00000 0.11111
0.09877
3
1.0 1 0.00000 0.00000 0.22222 0.13105
4 1.3 1
0.00000 0.00000 0.22222
0.13105
5 1.5
1 0.00000 0.00000
0.33333 0.15011
6 1.6 1 0.00000 0.00000 0.33333 0.15011
7 2.0 1
0.11111 0.09501 0.33333
0.15011
8 2.5
1 0.22222 0.12874
0.33333 0.15011
9 2.9 1 0.33333 0.15138 0.33333 0.15011
10 3.0
1 0.44444 0.16805 0.33333 0.15011
11 3.4
1 0.44444 0.16805
0.33333 0.15011
12
3.8 1 0.44444 0.16805 0.33333 0.15011
13 4.0 1
0.66667 0.18282 0.33333
0.15011
14 5.0
1 . . . .
15 0.5 2
0.00000 0.00000 0.00000
0.00000
16 0.9
2 0.00000 0.00000
0.11111 0.09877
17 1.0 2
0.00000 0.00000 0.11111
0.09877
18 1.3
2 0.00000 0.00000
0.22222 0.13105
19 1.5 2
0.00000 0.00000 0.22222
0.13105
20 1.6
2 0.00000 0.00000 0.33333 0.15011
21 2.0 2
0.00000 0.00000 0.33333
0.15011
22
2.5 2 0.11111 0.09501 0.33333 0.15011
23 2.9
2 0.11111 0.09501
0.44444 0.16011
24
3.0 2 0.11111 0.09501 0.44444 0.16011
25 3.4
2 0.22222 0.12584
0.44444 0.16011
26 3.8 2
0.22222 0.12584 0.44444
0.16011
27
4.0 2 0.38889 0.15518 0.44444
0.16011
28
5.0 2 0.55556 0.17107 0.44444 0.16011