Stata Technical Bulletin
We have created an example file from Oregon’s PUMS file called testor.dta. This example file is included on the
distribution diskette. This file contains 1474 records of persons with their associated household characteristics. The following
log file documents how we created testor.dta and displays some basic tabulations.
. * This section describes how to read in the data, and
. * how to combine the household and person records.
. *
. * Reduce maxvar to make room for all the observations.
. set maxvar 80
. * first read in the household data
. quietly infile using pumshl.dct if rectype==,,H,'
. * sort the data so it can be merged later
. sort SerialNo
. save hhl
file d:\pums\hhl.dta saved
. drop „all
. * now read in the person data
. quietly infile using pumspl.dct if rectype==,,P,'
. * again, sort it so it can be merged
. sort SerialNo
. save persl
file d:\pums\persl.dta saved
. * merge the data using the unique identifier uSerialNou
. merge SerialNo using hhl
. * check the merge to verify success
. tabulate „merge
„merge∣ |
Freq. |
Percent |
Cum. |
------------+— |
— | ||
2 I |
5904 |
4.02 |
4.02 |
3 I |
140984 |
95.98 |
100.00 |
------------+— |
— | ||
Total I |
146888 |
100.00 |
. drop if uniform()>.01
(145414 observations deleted)
. * create a test file which contains 1% of the cases
. save testor.dta
file d:\pums\testor.dta saved
. describe
Contains data from d:\pums\test.dta
Obs : 1474 (max=184695)
Vars: 42 (max= 80)
Width: 91 (max= 162)
1. rectype |
strl |
7.9 s |
2. SerialNo |
long |
7.10.0g |
3. relatl |
byte |
7.8.0g |
4. sex |
byte |
7.8.0g |
5. race |
int |
7.8.0g |
6. age |
byte |
7.8.0g |
7. marital |
byte |
7.8.0g |
8. pwgt1 |
int |
7.8.0g |
9. hispanic |
int |
7.8.0g |
10. poverty |
int |
7.8.0g |
11. rlabor |
byte |
7.8.0g |
12. industry |
int |
7.8.0g |
13. occup |
int |
7.8.0g |
14. class |
byte |
7.8.0g |
15. work89 |
byte |
7.8.0g |
16. week89 |
byte |
7.8.0g |
17. hour89 |
byte |
7.8.0g |
18. rearning |
long |
7.10.0g |
19. rpincome |
long |
7.10.0g |
20. income1 |
long |
7.10.0g |
21. income2 |
long |
7.10.0g |
22. income3 |
long |
7.10.0g |
23. income4 |
long |
7.10.0g |
24. income5 |
long |
7.10.0g |
25. income6 |
long |
7.10.0g |
26. income7 |
long |
7.10.0g |
27. income8 |
long |
7.10.0g |