-
Notifications
You must be signed in to change notification settings - Fork 0
/
analysis.sas
75 lines (67 loc) · 2.1 KB
/
analysis.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
OPTIONS FORMCHAR="|----|+|---+=|-/\<>*";
ods html close;
ods listing;
data WORK.FIXEDDATES ;
%let _EFIERR_ = 0;
infile 'C:\Users\ch151634\Dropbox\fixeddates.csv' delimiter = ';' MISSOVER DSD lrecl=32767 firstobs=2 ;
informat VAR1 best32. ;
informat SUBJECT_ID comma32. ;
informat HADM_ID comma32. ;
informat GENDER $1. ;
informat DOB DATE9. ;
informat DOD DATE9. ;
informat EXPIRE_FLG $1. ;
informat HOSPITAL_ADMIT_DT DATE9. ;
informat HOSPITAL_DISCH_DT DATE9. ;
informat HOSPITAL_EXPIRE_FLG $1. ;
informat first_drug1 $4. ;
format VAR1 best12. ;
format SUBJECT_ID comma12. ;
format HADM_ID comma12. ;
format GENDER $1. ;
format DOB DATE9. ;
format DOD DATE9. ;
format EXPIRE_FLG $1. ;
format HOSPITAL_ADMIT_DT DATE9. ;
format HOSPITAL_DISCH_DT DATE9. ;
format HOSPITAL_EXPIRE_FLG $1. ;
format first_drug1 $4. ;
input
VAR1
SUBJECT_ID
HADM_ID
GENDER $
DOB
DOD $
EXPIRE_FLG $
HOSPITAL_ADMIT_DT
HOSPITAL_DISCH_DT
HOSPITAL_EXPIRE_FLG $
first_drug1 $
;
if _ERROR_ then call symputx('_EFIERR_',1);
run;
proc freq data=fixeddates(where=(first_drug ne 'BOTH'));
table hospital_expire_flg * first_drug / norow chisq nopercent;
run;
proc freq data=fixeddates;
table hospital_expire_flg * first_drug / norow chisq fisher nopercent;
run;
data has_timevar;
set fixeddates;
if expire_flg = "Y" then time = dod - hospital_admit_dt;
if expire_flg = "N" then time = hospital_disch_dt - hospital_admit_dt;
censor = (expire_flg eq "N");
if hospital_expire_flg = "Y" then htime = dod - hospital_admit_dt;
if hospital_expire_flg = "N" then htime = hospital_disch_dt - hospital_admit_dt;
hcensor = (hospital_expire_flg eq "N");
run;
ods graphics on;
proc lifetest data=has_timevar(where=(first_drug1 ne "BOTH"));
time time * censor(1);
strata first_drug1;
run;
proc lifetest data=has_timevar(where=(first_drug1 ne "BOTH"));
time htime * hcensor(1);
strata first_drug1;
run;