Stata Technical Bulletin
27
. list id activity age birth year period
id |
activity |
age |
birth |
year |
period | |
1. |
1 |
nonactiv |
22 |
54 |
76 |
-90 |
2. |
1 |
selfemp |
27 |
54 |
81 |
-90 |
3. |
1 |
selfemp |
39 |
54 |
90 |
-90 |
4. |
1 |
selfemp |
39 |
54 |
91 |
[90-91 |
ε. |
1 |
selfemp |
39 |
54 |
93 |
[91- |
6. |
2 |
nonactiv |
19 |
74 |
90 |
-90 |
7. |
2 |
nonactiv |
19 |
74 |
91 |
[90-91 |
S. |
2 |
nonactiv |
19 |
74 |
93 |
[91- |
9. |
3 |
nonactiv |
19 |
65 |
84 |
-90 |
10. |
3 |
selfemp |
22 |
65 |
87 |
-90 |
11. |
3 |
waged |
28 |
65 |
90 |
-90 |
12. |
3 |
waged |
28 |
65 |
91 |
[90-91 |
13. |
3 |
waged |
28 |
65 |
93 |
[91- |
14. |
4 |
nonactiv |
7 |
70 |
77 |
-90 |
ιε. |
4 |
nonactiv |
20 |
70 |
90 |
-90 |
16. |
4 |
selfemp |
23 |
70 |
91 |
[90-91 |
17. |
4 |
selfemp |
23 |
70 |
93 |
[91- |
18. |
ε |
nonactiv |
4 |
68 |
72 |
-90 |
19. |
ε |
waged |
11 |
68 |
79 |
-90 |
20. |
ε |
nonactiv |
22 |
68 |
90 |
-90 |
21. |
ε |
waged |
26 |
68 |
91 |
[90-91 |
22. |
ε |
waged |
26 |
68 |
93 |
[91- |
23. |
6 |
nonactiv |
12 |
66 |
78 |
-90 |
24. |
6 |
nonactiv |
24 |
66 |
90 |
-90 |
28. |
6 |
waged |
27 |
66 |
91 |
[90-91 |
26. |
6 |
waged |
27 |
66 |
93 |
[91- |
27. |
7 |
nonactiv |
24 |
69 |
90 |
-90 |
28. |
7 |
nonactiv |
24 |
69 |
91 |
[90-91 |
29. |
7 |
nonactiv |
24 |
69 |
93 |
[91- |
30. |
8 |
nonactiv |
16 |
54 |
70 |
-90 |
31. |
8 |
nonactiv |
39 |
54 |
90 |
-90 |
32. |
8 |
nonactiv |
39 |
54 |
91 |
[90-91 |
33. |
8 |
nonactiv |
39 |
54 |
93 |
[91- |
Since every individual is observed as late as 1993 and none is observed in both 1990 and 1991, slicing the data on the
1990-91 interval affects the observations for each individual. For instance, slice adds two observations for individual ‘1’, one
for 1990, and one for 1991. The values of all the variables except year are copied down from the observation where year==93,
the first observation following the 1990-91 interval. As a consequence, the age is incorrect in the added observations. This
problem is easily corrected.
. replace age = year - birth
(13 real changes made)
Now we can examine activity in 1991 (period==l):
. tabulate activity sex if period==l
I Sex
Activityl |
Male |
Female I |
Total |
— | |||
nonactiV I |
0 |
3 I |
3 |
waged I |
1 |
2 I |
3 |
selfemp I |
2 |
0 I |
2 |
— | |||
Total I |
3 |
5 I |
8 |
Apart from descriptive analysis, the slice command is most useful in Cox regression, when we use time-varying regressors
to test the effect of passing through different calendar periods or age groups. For example, we can slice the time into three
periods: from the earliest year through 1980, from 1981 through 1990, and from 1991 until the time at survey (1993):
. use example, clear
. slice year, tvid(id) interval(80,90) saving(new) generate(period)
-80 + 8
[80-90 + 5
[90- --------
13 records added to 20
Note that age has to be corrected again, before running the regression:
. replace age = year - birth
(13 real changes made)
More intriguing information
1. Ein pragmatisierter Kalkul des naturlichen Schlieβens nebst Metatheorie2. An Economic Analysis of Fresh Fruit and Vegetable Consumption: Implications for Overweight and Obesity among Higher- and Lower-Income Consumers
3. The name is absent
4. Anti Microbial Resistance Profile of E. coli isolates From Tropical Free Range Chickens
5. An Efficient Secure Multimodal Biometric Fusion Using Palmprint and Face Image
6. he Effect of Phosphorylation on the Electron Capture Dissociation of Peptide Ions
7. The mental map of Dutch entrepreneurs. Changes in the subjective rating of locations in the Netherlands, 1983-1993-2003
8. Macroeconomic Interdependence in a Two-Country DSGE Model under Diverging Interest-Rate Rules
9. Prevalence of exclusive breastfeeding and its determinants in first 6 months of life: A prospective study
10. The name is absent