--------------------------------------------------------------------------------
log: C:\AAA Miker Files\newer web
pages\soc_meth_proj3\second class_2003.log
log type: text
opened on:
. set
mem 20m
Current
memory allocation
current memory usage
settable value description (1M = 1024k)
--------------------------------------------------------------------
set maxvar 5000
max. variables allowed 1.733M
set memory 20M max. data
space 20.000M
set matsize 400
max. RHS vars in models
1.254M
-----------
22.987M
. use
"C:\AAA Miker Files\newer web pages\soc_meth_proj3\cps_y2k_numeric.dta",
clear
[I opened the dataset
using file>open, and STATA printed this command to
the log]
[
. version
7.0
[if
you purchase the software yourself you're using STATA 8, and if you're having
trouble getting some command to work for you the way I demonstrated it, you can
use version control to tell stata to behave as if it were still version 7]
. describe
Contains
data from C:\AAA Miker Files\newer web pages\soc_meth_proj3\cps_y2k_nu
>
meric.dta
obs: 133,710
vars: 39
size: 9,493,410 (54.7% of memory free)
-------------------------------------------------------------------------------
storage display value
variable name
type format label
variable label
-------------------------------------------------------------------------------
phseq
str5 %9s household sequence number p2
pernum
byte %8.0g
age
byte %8.0g p15
maritl
byte %26.0g marlbl
Marital Status p17
sex
byte %8.0g sexnm p20
vet
byte %22.0g vetnm
veteran status p21
hga
byte %8.0g Educational Attainment p22
race
byte %11.0g racenm
p25
reorigin
byte %8.0g Hispanic Origin p27
hrs1
byte %8.0g hours worked last week p76
clswkr
byte %32.0g cwrknm
sector of worker p109
grswk
int %9.0g gross weekly wages p135
unmem
byte %13.0g unnm
labor union member p139
lfsr
byte %28.0g lfsrnm
labor force status p145
ernval
float %9.0g main job last year earnings
p228
ssval
long %12.0g last year soc security payments
p291
pawval
int %12.0g last year welfare payments
p305
wgt2
int %9.0g rounded weight based on p50
ernval2
float %9.0g main job earnings, losses
recoded to zero
htype
byte %37.0g htpnm
household type h25
state
byte %8.0g HG-ST60, or simply state of
residence h40
hpmsasz
byte %8.0g metropolitan area size h56
hcccr
byte %8.0g residence in central city h58
frelu18
byte %8.0g number of kids in fam under
18
f29
povll
byte %8.0g ratio of fam income to
poverty
level f38
fwsval
float %9.0g family income f48
famwgt2
int %8.0g adjusted family weight f233
yrsed
float %9.0g years of education, from hga
citizen
byte %33.0g citnm
citizenship p733
health
byte %11.0g hlthnm
self reported health status p800
occ
int %8.0g occupation P 106
ptotr
byte %8.0g total person income
categories
P466
penatvty
int %8.0g country of birth P 722,
Appendix H
pemntvty
int %8.0g Mother's country of birth,
P725, appendix H
pefntvty
int %8.0g Father's country of birth,
P728, appendix H
peinusyr
byte %8.0g time of immigration, P 731
pxnatvty
byte %8.0g allocation flag for country
of
birth P 734
hgmsac
int %8.0g metropolitan area code, h44,
appendix E
pppos2 byte
%8.0g family
sequence number within
each household p46
-------------------------------------------------------------------------------
Sorted
by: race
. tabulate
citizen
citizenship
p733 | Freq. Percent Cum.
----------------------------------+-----------------------------------
native
born in US | 116220 86.92 86.92
native, born in
territories | 1090 0.82 87.73
native, born abroad of US parents | 976 0.73 88.46
foreign born,
naturalized | 5348 4.00 92.46
foreign born, non
----------------------------------+-----------------------------------
Total | 133710
100.00
. tabulate
citizen [fweight=wgt2]
citizenship
p733 | Freq. Percent Cum.
----------------------------------+-----------------------------------
native
born in US | 241895378 88.53 88.53
native, born in
territories | 1587797 0.58 89.11
native, born abroad of US parents | 1879470 0.69 89.80
foreign born,
naturalized | 10496702 3.84 93.64
foreign born, non
----------------------------------+-----------------------------------
Total | 273233821 100.00
. summarize
citizen
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
citizen | 133710
1.44417 1.185647 1 5
. *summarizing categorical
variables is possible but it doesn't tell you anythi
> ng
interesting
. tabulate
citizen [fweight=wgt2], nolabel
citizenship |
p733 | Freq. Percent Cum.
------------+-----------------------------------
1 | 241895378 88.53 88.53
2 |
1587797 0.58 89.11
3 |
1879470 0.69 89.80
4 |
10496702 3.84 93.64
5 |
17374474 6.36 100.00
------------+-----------------------------------
Total | 273233821 100.00
. sort
citizen
. by
citizen: summarize ernval2 if age> 20
& age<65
_______________________________________________________________________________
->
citizen = native born in US
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 |
62868 27020.52 31256.2 0
362302
_______________________________________________________________________________
->
citizen = native, born in territories
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 776
17769.34 27815.81 0
362302
_______________________________________________________________________________
->
citizen = native, born abroad of US parents
Variable | Obs
Mean Std. Dev. Min
Max
-------------+-----------------------------------------------------
ernval2 | 620
27129.39 29420.01 0
229339
_______________________________________________________________________________
->
citizen = foreign born, naturalized
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 4014
27132.11 34399.5 0
362302
_______________________________________________________________________________
->
citizen = foreign born, non
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 7636
16504.61 23940.32 0
362302
.
by citizen: summarize ernval2 if age> 20 & age<65
& ernval2>0 & sex==1 [fweight=wgt2]
_______________________________________________________________________________
->
citizen = native born in US
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 5.8e+07 41094.14
37787.74 1 362302
_______________________________________________________________________________
->
citizen = native, born in territories
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 458736 28015.47
20287.07 1 120000
_______________________________________________________________________________
->
citizen = native, born abroad of US parents
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 531903 40651.84
33628.36 600 229339
_______________________________________________________________________________
->
citizen = foreign born, naturalized
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 3.4e+06 44372.85
43359.62 1 362302
_______________________________________________________________________________
->
citizen = foreign born, non
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 6.0e+06 28258.6
32207.03 1
362302
. *What about education?
. by
citizen: summarize yrsed if age> 20
& age<65 & ernval2>0 &
sex==1 [fweight=wgt2]
_______________________________________________________________________________
->
citizen = native born in US
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
yrsed |
5.8e+07 13.58493 2.425652 0 22
_______________________________________________________________________________
->
citizen = native, born in territories
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
yrsed | 458736
11.82379 4.219794 0 22
_______________________________________________________________________________
->
citizen = native, born abroad of US parents
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
yrsed | 531903
13.69144 2.892469 1.5 22
_______________________________________________________________________________
->
citizen = foreign born, naturalized
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
yrsed |
3.4e+06 13.34986 3.896225 0 22
_______________________________________________________________________________
->
citizen = foreign born, non
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
yrsed |
6.0e+06 11.29091 4.532244 0
22
. by
citizen: summarize ernval2 if age> 20
& age<65 & ernval2>0 &
sex==1 & yrsed=12 [fweight=wgt2]
[I forgot the double
equals after yrsed]
_______________________________________________________________________________
->
citizen = native born in US
too many weights
r(198);
. by
citizen: summarize ernval2 if age> 20
& age<65 & ernval2>0 &
sex==1 & yrsed==12 [fweight=wgt2]
_______________________________________________________________________________
->
citizen = native born in US
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 2.0e+07 31287.93
23807.94 1 257525
_______________________________________________________________________________
->
citizen = native, born in territories
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 121217 22362.75
13054.69 1 54000
_______________________________________________________________________________
->
citizen = native, born abroad of US parents
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 134338 26315.81
14649.03 690 60000
_______________________________________________________________________________
->
citizen = foreign born, naturalized
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 918928 32132.84
27848.1 1 229339
_______________________________________________________________________________
->
citizen = foreign born, non
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 1.7e+06 22833.9
17552.92 1 229339
. tabulate
hga, nolabel
Educational
|
Attainment |
p22 | Freq. Percent Cum.
------------+-----------------------------------
0 | 30484 22.80 22.80
31 | 457 0.34 23.14
32 | 1187 0.89 24.03
33 | 2320 1.74 25.76
34 | 4527 3.39 29.15
35 | 4161 3.11 32.26
36 | 4695 3.51 35.77
37 |
4721 3.53 39.30
38 | 1491 1.12 40.42
39 | 31970 23.91 64.33
40 | 18797 14.06 78.39
41 | 3758 2.81 81.20
42 | 3328 2.49 83.69
43 | 14705 11.00 94.68
44 | 4918 3.68 98.36
45 | 1229 0.92 99.28
46 | 962 0.72 100.00
------------+-----------------------------------
Total | 133710
100.00
. table
hga, contents (mean yrsed)
-----------------------
Education
|
al |
Attainmen
|
t p22 |
mean(yrsed)
----------+------------
0 | 0
31 | 0
32 | 1.5
33 | 5.5
34 | 7.5
35 | 9
36 | 10
37 | 11
38 | 12
39 | 12
40 | 13
41 |
14
42 | 14
43 | 16
44 | 17
45 | 19
46 | 22
-----------------------
. generate edlvl=0
. replace
edlvl=1 if hga==38
(1491
real changes made)
. replace
edlvl=2 if hga==39
(31970
real changes made)
. replace
edlvl=3 if hga>39
(47697
real changes made)
. table
hga, contents (mean edlvl)
-----------------------
Education
|
al |
Attainmen
|
t p22 |
mean(edlvl)
----------+------------
0
| 0
31 | 0
32 | 0
33 | 0
34 | 0
35 | 0
36 | 0
37 | 0
38 | 1
39 | 2
40 | 3
41 | 3
42 | 3
43 | 3
44 | 3
45 | 3
46 | 3
-----------------------
. label
define edlabel 0 "<12th grade" 1 "12 grade, no dip" 2
"HS diploma" 3 "> HS"
. label
values edlvl edlabel
. label
edlvl "4 categories ed attainment"
invalid syntax
r(198);
. label
var edlvl "4 categories ed attainment"
. sort
edlvl
. by
race: summarize ernval2
not sorted
r(5);
. sort
edlvl
. sort
sex edlvl
. by
sex edlvl: summarize ernval2 if age>20 & age<65 & ernval2>0
[fweight=wgt2]
_______________________________________________________________________________
->
sex = male, edlvl = <12th grade
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 6.9e+06 20615.84
16778.24 1 229339
_______________________________________________________________________________
->
sex = male, edlvl = 12 grade, no dip
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 787711 23366.43
17959.61 1 150000
_______________________________________________________________________________
->
sex = male, edlvl = HS diploma
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 2.2e+07 30875.95
23745.32 1 257525
_______________________________________________________________________________
->
sex = male, edlvl = >HS
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 3.9e+07 48961.24
43910.57 1 362302
_______________________________________________________________________________
->
sex = female, edlvl = <12th grade
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 4.7e+06 12153.76
11896.09 1 197387
_______________________________________________________________________________
->
sex = female, edlvl = 12 grade, no dip
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 543227 15408.9
13123.84 96 130000
_______________________________________________________________________________
->
sex = female, edlvl = HS diploma
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 1.9e+07 18388.31
14780.26 1 333564
_______________________________________________________________________________
->
sex = female, edlvl = >HS
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 3.7e+07 28428.44
24451.71 1 333564
. by
sex edlvl: summarize ernval2 age if age>20 & age<65 &
ernval2>0 [fweight=wgt2]
_______________________________________________________________________________
->
sex = male, edlvl = <12th grade
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 6.9e+06 20615.84
16778.24 1 229339
age |
6.9e+06 39.87845 12.28925 21 64
_______________________________________________________________________________
->
sex = male, edlvl = 12 grade, no dip
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 787711 23366.43
17959.61 1 150000
age | 787711
36.30828 10.67245 21 64
_______________________________________________________________________________
->
sex = male, edlvl = HS diploma
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 2.2e+07 30875.95
23745.32 1 257525
age |
2.2e+07 39.48721 11.01249 21 64
_______________________________________________________________________________
->
sex = male, edlvl = >HS
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 3.9e+07 48961.24
43910.57 1 362302
age |
3.9e+07 40.35842 11.02373 21 64
_______________________________________________________________________________
->
sex = female, edlvl = <12th grade
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 4.7e+06 12153.76
11896.09 1 197387
age |
4.7e+06 40.76914 11.76523 21 64
_______________________________________________________________________________
->
sex = female, edlvl = 12 grade, no dip
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 543227 15408.9
13123.84 96 130000
age | 543227
37.89884 10.66215 21 62
_______________________________________________________________________________
->
sex = female, edlvl = HS diploma
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 1.9e+07 18388.31
14780.26 1 333564
age |
1.9e+07 40.86394 11.24467 21 64
_______________________________________________________________________________
->
sex = female, edlvl = >HS
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 3.7e+07 28428.44
24451.71 1 333564
age |
3.7e+07 39.32518 10.94315 21 64
. tabulate citizen
citizenship
p733 | Freq. Percent Cum.
----------------------------------+-----------------------------------
native
born in US | 116220 86.92 86.92
native, born in
territories | 1090 0.82 87.73
native, born abroad of US parents | 976 0.73 88.46
foreign born,
naturalized | 5348 4.00 92.46
foreign born, non
----------------------------------+-----------------------------------
Total | 133710
100.00
. tabulate
citizen, nolabel
citizenship |
p733 | Freq. Percent Cum.
------------+-----------------------------------
1 | 116220 86.92 86.92
2 | 1090 0.82 87.73
3 | 976 0.73 88.46
4 | 5348 4.00 92.46
5 | 10076 7.54 100.00
------------+-----------------------------------
Total | 133710
100.00
. generate
immigrant=1 if citizen<4
(15424
missing values generated)
. replace
immigrant=2 if citizen>3
(15424
real changes made)
. define
label immigrant_cat 1 "native" 2 "immigrant"
unrecognized command:
define
r(199);
. label
define immigrant_cat 1 "native" 2 "immigrant"
. label
val immigrant immigrant_cat
. sort
immigrant
. label
define immigrant_lbl 1 "native" 2 "immigrant"
. label
val immigrant immigrant_lbl, replace
replace not allowed
r(101);
.
label val immigrant immigrant_lbl
. by
immigrant: summarize ernval2 age yrsed
_______________________________________________________________________________
->
immigrant = native
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 | 118286 15307.48
26922.34 0 362302
age | 118286
34.70264 22.66807 0 90
yrsed | 118286
9.603186 6.003554 0 22
_______________________________________________________________________________
->
immigrant = immigrant
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 |
15424 15875.95 26585.98 0
362302
age | 15424
38.83772 17.98077 0 90
yrsed | 15424
10.20478 5.132426 0 22
.
by immigrant: summarize ernval2 age yrsed if age>20
& age<65
_______________________________________________________________________________
->
immigrant = native
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 |
64264 26909.86 31215.65 0
362302
age | 64264
41.24163 11.64261 21 64
yrsed | 64264
13.35139 2.453572 0 22
_______________________________________________________________________________
->
immigrant = immigrant
Variable | Obs
Mean Std. Dev. Min Max
-------------+-----------------------------------------------------
ernval2 |
11650 20166.31 28439.47 0
362302
age | 11650
38.92858 11.27594 21 64
yrsed | 11650
11.21807 4.441233 0 22
. save "C:\AAA
Miker Files\newer web pages\soc_meth_proj3\cps_y2k_numeric.dta", replace
file C:\AAA Miker Files\newer web
pages\soc_meth_proj3\cps_y2k_numeric.dta saved
[The save command was
executed through the menu File> Save, and this line was just printed into
the log to inform me]
.
exit, clear