I am using STATA 16.0 for windows.
I want to left censor the data so that AdultID is left censored if they appear in the first period. BUT.... here is the hard part for me, i want that AdultID to remain in the dataset if they miss a period or two, but then appear again later. So i want to remove their first 'spell' in the data set, but keep them in for any subsequent 'spells'. I assume i will need to do some sort of loop command.
For example for this AdultID, they appear in period 1 and 2, 7and8, and 19and20. I only want to drop the first spell where they appear in the first and second month because i do not know how many months they were in prior to the first month of my dataset.
AdultID period firstmonth lastmonth
AA19445C 1 1 20
AA19445C 2 1 20
AA19445C 7 1 20
AA19445C 8 1 20
AA19445C 19 1 20
AA19445C 20 1 20
Here is a sample of my data....
.
. dataex AdultID period firstmonth lastmonth
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str8 AdultID float(period firstmonth lastmonth) "AA000J5L" 1 1 22 "AA000J5L" 2 1 22 "AA000J5L" 3 1 22 "AA000J5L" 4 1 22 "AA000J5L" 5 1 22 "AA000J5L" 6 1 22 "AA000J5L" 7 1 22 "AA000J5L" 8 1 22 "AA000J5L" 9 1 22 "AA000J5L" 10 1 22 "AA000J5L" 11 1 22 "AA000J5L" 12 1 22 "AA000J5L" 13 1 22 "AA000J5L" 14 1 22 "AA000J5L" 15 1 22 "AA000J5L" 16 1 22 "AA000J5L" 17 1 22 "AA000J5L" 18 1 22 "AA000J5L" 19 1 22 "AA000J5L" 20 1 22 "AA000J5L" 21 1 22 "AA000J5L" 22 1 22 "AA03597B" 20 20 24 "AA03597B" 21 20 24 "AA03597B" 22 20 24 "AA03597B" 23 20 24 "AA03597B" 24 20 24 "AA05469D" 9 9 11 "AA05469D" 11 9 11 "AA05568B" 1 1 24 "AA05568B" 2 1 24 "AA05568B" 3 1 24 "AA05568B" 4 1 24 "AA05568B" 5 1 24 "AA05568B" 6 1 24 "AA05568B" 7 1 24 "AA05568B" 8 1 24 "AA05568B" 9 1 24 "AA05568B" 10 1 24 "AA05568B" 11 1 24 "AA05568B" 12 1 24 "AA05568B" 13 1 24 "AA05568B" 14 1 24 "AA05568B" 15 1 24 "AA05568B" 16 1 24 "AA05568B" 17 1 24 "AA05568B" 18 1 24 "AA05568B" 19 1 24 "AA05568B" 20 1 24 "AA05568B" 21 1 24 "AA05568B" 22 1 24 "AA05568B" 23 1 24 "AA05568B" 24 1 24 "AA05824D" 1 1 9 "AA05824D" 2 1 9 "AA05824D" 3 1 9 "AA05824D" 4 1 9 "AA05824D" 5 1 9 "AA05824D" 6 1 9 "AA05824D" 7 1 9 "AA05824D" 8 1 9 "AA05824D" 9 1 9 "AA07275F" 14 14 24 "AA07275F" 15 14 24 "AA07275F" 16 14 24 "AA07275F" 17 14 24 "AA07275F" 19 14 24 "AA07275F" 20 14 24 "AA07275F" 21 14 24 "AA07275F" 22 14 24 "AA07275F" 23 14 24 "AA07275F" 24 14 24 "AA10840J" 3 3 11 "AA10840J" 4 3 11 "AA10840J" 6 3 11 "AA10840J" 7 3 11 "AA10840J" 8 3 11 "AA10840J" 9 3 11 "AA10840J" 10 3 11 "AA10840J" 11 3 11 "AA11244G" 2 2 24 "AA11244G" 3 2 24 "AA11244G" 4 2 24 "AA11244G" 5 2 24 "AA11244G" 6 2 24 "AA11244G" 7 2 24 "AA11244G" 8 2 24 "AA11244G" 9 2 24 "AA11244G" 10 2 24 "AA11244G" 11 2 24 "AA11244G" 12 2 24 "AA11244G" 13 2 24 "AA11244G" 14 2 24 "AA11244G" 15 2 24 "AA11244G" 16 2 24 "AA11244G" 17 2 24 "AA11244G" 18 2 24 "AA11244G" 19 2 24 "AA11244G" 20 2 24 "AA11244G" 21 2 24 end
Listed 100 out of 189543 observations
Use the count() option to list more
0 Response to Survival analysis setup.
Post a Comment