Skip to content

Commit

Permalink
Update 202_cr_prevalent_cohort_prevalence.do
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyherrett committed Jun 16, 2024
1 parent 801bd94 commit d17648d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions analysis/202_cr_prevalent_cohort_prevalence.do
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ foreach drug in aa betablockers mra arni sglt2i two_pillars three_pillars four_p
append using "$tabfigdir/prevalent_prevalences_summary_`hftype'_`year'"
}

* Redact numbers less than 7
foreach var in total ondrug {
replace `var'=. if `var'<=7
}

* Rounding numbers in table to nearest 5
noi display "round numbers to the nearest 5"
foreach var in total ondrug {
Expand All @@ -112,7 +117,7 @@ foreach drug in aa betablockers mra arni sglt2i two_pillars three_pillars four_p
}
* Calculate the proportion
gen proportion=(ondrug/total)

* Calculate the confidence intervals for each proportion
noi display "make confidence intervals for each proportion"
gen lci = .
Expand All @@ -123,7 +128,7 @@ foreach drug in aa betablockers mra arni sglt2i two_pillars three_pillars four_p
local ondrug = ondrug[`i']
local total = total[`i']
display `i'
cii proportions `total' `ondrug'
capture cii proportions `total' `ondrug'
display r(lb)
display r(ub)
replace lci = r(lb) in `i'
Expand Down Expand Up @@ -227,9 +232,9 @@ foreach drug in aa betablockers mra arni sglt2i two_pillars three_pillars four_p
replace cat="No diabetes" if variable=="Diabetes" & category==0
replace cat="Diabetes" if variable=="Diabetes" & category==1

replace cat="No CKD" if variable=="CKD" & category==0
replace cat="CKD stage 3, eGFR 30-60" if variable=="CKD" & category==1
replace cat="CKD stage 4/5, eGFR <30" if variable=="CKD" & category==2
replace cat="No CKD" if variable=="CKD" & category==1
replace cat="CKD stage 3, eGFR 30-60" if variable=="CKD" & category==2
replace cat="CKD stage 4/5, eGFR <30" if variable=="CKD" & category==3

*replace cat="No CLD" if variable=="CLD" & category==0
*replace cat="CLD" if variable=="CLD" & category==1
Expand Down

0 comments on commit d17648d

Please sign in to comment.