24
Stata Technical Bulletin
STB-22
In this example, censor generates two variables, jobl and Tjobl. jobl is the 0/1 variable that records the individual’s
change in status. Tjobl records the time—age in this example—at which the change occurs. For individual ‘1’, the transition
took place at the end of the first observation, when he passed from the not working state to the self-employed state. This
individual was 22 years old at the end of the first observation.
Censoring can occur for reasons unrelated to the phenomenon under study. In this example data set, some individuals are
lost from the survey. The variable lost is coded as ‘0’ when an individual is still in the survey and as ‘1’ when the individual
is “lost”.
The before () option of censor provides a convenient way to handle the lost individuals:
. drop jobl Tjobl
. censor id age = activity==l ∣ activity==2, generate(jobl) before(Iost==I)
. list id activity age lost jobl Tjobl
id |
activity |
age |
lost |
jobl |
TjObl | |
1. |
1 |
nonactiv |
22 |
in |
1 |
22 |
2. |
1 |
selfemp |
27 |
in | ||
3. |
1 |
selfemp |
39 |
in | ||
4. |
2 |
nonactiv |
19 |
in |
O |
19 |
ε. |
3 |
nonactiv |
19 |
in |
1 |
19 |
6. |
3 |
selfemp |
22 |
in |
. |
. |
7. |
3 |
waged |
28 |
in |
. |
. |
S. |
4 |
nonactiv |
7 |
in |
O |
7 |
9. |
4 |
nonactiv |
20 |
out |
. |
. |
10. |
4 |
selfemp |
23 |
out |
. |
. |
11. |
ε |
nonactiv |
4 |
in |
1 |
4 |
12. |
ε |
waged |
11 |
in |
. |
. |
13. |
ε |
nonactiv |
22 |
in |
. |
. |
14. |
ε |
waged |
28 |
in |
. |
. |
ιε. |
6 |
nonactiv |
12 |
in |
O |
12 |
16. |
6 |
nonactiv |
24 |
out |
. |
. |
17. |
6 |
waged |
27 |
out |
. |
. |
18. |
7 |
nonactiv |
24 |
in |
O |
24 |
19. |
8 |
nonactiv |
16 |
in |
O |
16 |
20. |
8 |
nonactiv |
39 |
out |
Suppose we need to create two censoring variables for two competing risks; for example, wage-work and self-employment.
censor can handle this case as well:
. censor id age = activity==!, generate(waged) before(Iost==I ∣ activity==2)
. censor id age = activity==2, generate(self) before(lost==l ∣ activity==l)
. list id activity age waged Twaged self Tself, nodisplay
id |
activity |
age |
waged |
Twaged |
self |
Tself | |
1. |
1 |
nonactiV |
22 |
O |
22 |
1 |
22 |
2. |
1 |
selfemp |
27 | ||||
3. |
1 |
selfemp |
39 | ||||
4. |
2 |
nonactiV |
19 |
O |
19 |
O |
19 |
ε. |
3 |
nonactiV |
19 |
O |
19 |
1 |
19 |
6. |
3 |
selfemp |
22 |
. |
. |
. |
. |
7. |
3 |
waged |
28 |
. |
. |
. |
. |
8. |
4 |
nonactiV |
7 |
O |
7 |
O |
7 |
9. |
4 |
nonactiV |
20 |
. |
. |
. |
. |
10. |
4 |
selfemp |
23 |
. |
. |
. |
. |
11. |
ε |
nonactiV |
4 |
1 |
4 |
O |
4 |
12. |
ε |
waged |
11 |
. |
. |
. |
. |
13. |
ε |
nonactiV |
22 |
. |
. |
. |
. |
14. |
ε |
waged |
26 |
. |
. |
. |
. |
ιε. |
6 |
nonactiV |
12 |
O |
12 |
O |
12 |
16. |
6 |
nonactiV |
24 |
. |
. |
. |
. |
17. |
6 |
waged |
27 |
. |
. |
. |
. |
18. |
7 |
nonactiV |
24 |
O |
24 |
O |
24 |
19. |
8 |
nonactiV |
16 |
O |
16 |
O |
16 |
20. |
8 |
nonactiV |
39 |
More intriguing information
1. The resources and strategies that 10-11 year old boys use to construct masculinities in the school setting2. Antidote Stocking at Hospitals in North Palestine
3. Telecommuting and environmental policy - lessons from the Ecommute program
4. Volunteering and the Strategic Value of Ignorance
5. The name is absent
6. Visual Artists Between Cultural Demand and Economic Subsistence. Empirical Findings From Berlin.
7. The Response of Ethiopian Grain Markets to Liberalization
8. The name is absent
9. Quality practices, priorities and performance: an international study
10. The name is absent