has_fracture_now i created based on wether or not the patient has a diagnosiscode to begin with, using the following command:
This is just before all the commands in #9
With the 116.519 patients remaining the "has_fracture_now" has 4018 1's and the initial "diag", from which it was created also has 4018 1's.
The diagnosiscode-variabel, used to estimate specific fracture-types has 16.273 1's (fracturecodes), which correlates perfectly to "first_poststroke_fx_date", which also has 16.273 1's (dates)
That's why i think maybe something goes wrong when using
Code:
gen has_fracture_now = 1 replae has_fracture_now = 0 if missing(diag) label define has_fracture_now 0 "No fracture" 1 "Fracture" label values has_fracture_now has_fracture_now
With the 116.519 patients remaining the "has_fracture_now" has 4018 1's and the initial "diag", from which it was created also has 4018 1's.
The diagnosiscode-variabel, used to estimate specific fracture-types has 16.273 1's (fracturecodes), which correlates perfectly to "first_poststroke_fx_date", which also has 16.273 1's (dates)
That's why i think maybe something goes wrong when using
Code:
by person_id: egen had_fracture = max(has_fracture_now)
Comment