generated from opensafely/research-template
/
AL001_describe_cohort.do
176 lines (118 loc) · 3.36 KB
/
AL001_describe_cohort.do
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
********************************************************************************
*
* Do-file: AL001_describe_cohort.do
*
* Programmed by: Fizz & John
*
* Data used: data/cr_base_cohort.dta
*
* Data created: None
*
* Other output: Log file: output/AL001_describe_cohort.log
*
********************************************************************************
*
* Purpose: This do-file describes the data in the analysis datasets and
* puts the output in a log file.
*
*********************************************************************************
clear all
set more off
* Open a log file
cap log close
log using "logs/AL001_describe_cohort", replace text
* Add ado files
adopath++ `c(pwd)'\analysis
* Wave 1: i=1 (1 Mar 20 - 31 Aug 20)
* Wave 2: i=2 (1 Sept 20 - latest)
forvalues i = 1 (1) 2 {
/* Open base cohort */
use "analysis/data_ldanalysis_cohort`i'.dta", clear
/* Complete case for ethnicity */
safetab ethnicity_5
safetab ethnicity_5, m
drop if ethnicity_5>=.
*********************************
* Describe exposure variables *
*********************************
safetab ldr
safetab ld_profound ldr, m
safetab ldr_cat
safetab ldr_carecat ldr, m
safetab ldr_carecat
safetab ds ldr, m
safetab ds
safetab cp ldr, m
safetab cp
safetab ldr_group ldr, m
safetab ldr_group cp, m
safetab ldr_group ds, m
safetab ldr_group
***********************************
* Describe confounder variables *
***********************************
* Area
safetab region_7, m
safetab stp, m
* Age, sex and ethnicity
summ age, d
safetab agegroup, m
safetab child, m
bysort child: summ age, d
safetab male, m
* Ethnicity
safetab ethnicity_5, m
safetab ethnicity_16, m
********************************************
* Describe potential mediators variables *
********************************************
* Deprivation
safetab imd, m
* Residential care
safetab resid_care_old, m
safetab resid_care_ldr, m
sum household_size, d
safetab resid_care_old resid_care_ldr
*******************************************
* Describe comorbidities (adjusted for) *
*******************************************
* BMI
summ bmi, d
safetab obese40, m
* Physical comorbidities, also indicators for vaccination
foreach var of varlist asthma_severe cf respiratory ///
cardiac af dvt_pe diabcat ///
liver stroke tia dementia ///
kidneyfn {
safetab `var', m
}
* Indicators for immunosuppression (an indication for vaccination)
foreach var of varlist spleen transplant dialysis ///
immunosuppression cancerHaem ///
autoimmune ibd cancerExhaem1yr {
safetab `var', m
}
*****************************************************
* Describe other vaccine priority group variables *
*****************************************************
foreach var of varlist smi neuro {
safetab `var', m
}
********************************
* Describe outcome variables *
********************************
summ coviddeath_date otherdeath_date covidadmission_date composite_date, d format
if `i'==1 {
safetab coviddeath1
safetab covidadmission1
safetab coviddeath1 covidadmission1
safetab composite1
}
safetab coviddeath2
safetab covidadmission2
safetab coviddeath2 covidadmission2
safetab composite2
summ stime*
}
* Close log file
log close