--------------------------------------------------------------------------------------------

      name:  <unnamed>

       log:  C:\Users\Michael\Documents\newer web pages\soc_meth_proj3\soc_180B_win2013\clas

> s3.log

  log type:  text

 opened on:  17 Jan 2013, 13:51:59

 

. use "C:\Users\Michael\Desktop\cps_mar_2000_new_unchanged.dta", clear

 

. summarize incwage

 

    Variable |       Obs        Mean    Std. Dev.       Min        Max

-------------+--------------------------------------------------------

     incwage |    103226    19462.59    28843.38          0     364302

 

* One thing to notice about incwage is that there are fewer than 133,710 cases. That means some values are missing. Look up the variable in ipums to see why… It turns out that children are not in the universe for the income question.

 

 

. tabulate incwage if age <15

no observations

 

. tabulate incwage if age <15, miss

 

   Wage and |

     salary |

     income |      Freq.     Percent        Cum.

------------+-----------------------------------

          . |     30,484      100.00      100.00

------------+-----------------------------------

      Total |     30,484      100.00

 

* Ordinarily, STATA does not show you missing values in a table, but if you specify the option “miss”, it will show you the missing values and note: the missing value code for numerical variables is the period.

 

. tabulate citizen

 

             Citizenship status |      Freq.     Percent        Cum.

--------------------------------+-----------------------------------

                            NIU |    117,310       87.73       87.73

Born abroad of American parents |        976        0.73       88.46

            Naturalized citizen |      5,348        4.00       92.46

                  Not a citizen |     10,076        7.54      100.00

--------------------------------+-----------------------------------

                          Total |    133,710      100.00

 

* If we want to work with the variable citizen, we need to know the numerical codes beneath the value labels.

 

. codebook citizen

 

------------------------------------------------------------------------------------

citizen                                                           Citizenship status

------------------------------------------------------------------------------------

 

                  type:  numeric (byte)

                 label:  citizenlbl

 

                 range:  [0,3]                        units:  1

         unique values:  4                        missing .:  0/133710

 

            tabulation:  Freq.   Numeric  Label

                        1.2e+05        0  NIU

                           976         1  Born abroad of American parents

                          5348         2  Naturalized citizen

                         10076         3  Not a citizen

 

. tabulate citizen, nolab

 

Citizenship |

     status |      Freq.     Percent        Cum.

------------+-----------------------------------

          0 |    117,310       87.73       87.73

          1 |        976        0.73       88.46

          2 |      5,348        4.00       92.46

          3 |     10,076        7.54      100.00

------------+-----------------------------------

      Total |    133,710      100.00

 

* And by the way, if we want to know where the citizen=NIU people were born, we can cross-tabulate with bpl.

 

. tabulate  bpl citizen

 

                      |             Citizenship status

           Birthplace |       NIU  Born abro  Naturaliz  Not a cit |     Total

----------------------+--------------------------------------------+----------

  United States, n.s. |   116,213          0          0          0 |   116,213

          Puerto Rico |       950          0          0          0 |       950

U.S. outlying areas,  |       140          0          0          0 |       140

               Canada |         0        102        135        179 |       416

              Bermuda |         0          2          0          1 |         3

  North America, n.s. |         0          0          4         10 |        14

               Mexico |         4        155      1,090      4,294 |     5,543

Belize/British Hondur |         0          0          9         17 |        26

           Costa Rica |         0          1         19         33 |        53

          El Salvador |         3         13        107        461 |       584

            Guatemala |         0          1         45        186 |       232

             Honduras |         0          5         42        120 |       167

            Nicaragua |         0          5         31        125 |       161

               Panama |         0         13         20         20 |        53

Central America, n.s. |         0          3         24         83 |       110

                 Cuba |         0          5        382        282 |       669

   Dominican Republic |         0          6        170        326 |       502

                Haiti |         0          0         60         94 |       154

              Jamaica |         0          3         85         75 |       163

              Bahamas |         0          3          3          4 |        10

             Barbados |         0          1         13         10 |        24

             Dominica |         0          0          0          4 |         4

              Grenada |         0          1          6          9 |        16

  Trinidad and Tobago |         0          1         32         41 |        74

      Caribbean, n.s. |         0          3         14         18 |        35

            Argentina |         0          2         30         28 |        60

              Bolivia |         0          0          7         19 |        26

               Brazil |         0          3         17         68 |        88

                Chile |         0          3         27         26 |        56

             Colombia |         0          5        120        193 |       318

              Ecuador |         0          3         67        144 |       214

Guyana/British Guiana |         0          1         61         41 |       103

                 Peru |         0          3         68        152 |       223

              Uruguay |         0          0         18         26 |        44

            Venezuela |         0          8         26         46 |        80

  South America, n.s. |         0          1         19         20 |        40

              Denmark |         0          1          4          2 |         7

              Finland |         0          1          3          4 |         8

               Norway |         0          4          3          7 |        14

               Sweden |         0          3          5         17 |        25

              England |         0         72         95        124 |       291

             Scotland |         0          7         22         16 |        45

 United Kingdom, n.s. |         0          2          1          7 |        10

              Ireland |         0          4         52         38 |        94

              Belgium |         0          5          4          5 |        14

               France |         0         26         34         25 |        85

          Netherlands |         0          4         24         18 |        46

          Switzerland |         0          1          6          8 |        15

               Greece |         0          1         44         17 |        62

                Italy |         0         25        144         53 |       222

             Portugal |         0          4         39         51 |        94

               Azores |         0          2         14          5 |        21

                Spain |         0         14         25         22 |        61

              Austria |         0          2         20          9 |        31

       Czechoslavakia |         0          0         14          6 |        20

             Slovakia |         0          0          3          0 |         3

       Czech Republic |         0          0          6          1 |         7

              Germany |         0        234        170        109 |       513

              Hungary |         0          0         21         14 |        35

               Poland |         0          7        101         96 |       204

              Romania |         0          0         22         19 |        41

           Yugoslavia |         0          1         18         43 |        62

               Latvia |         0          0          4          0 |         4

            Lithuania |         0          0          3         15 |        18

    Other USSR/Russia |         0          4         62         88 |       154

              Ukraine |         0          0         23         37 |        60

           USSR, n.s. |         0          0          7         18 |        25

         Europe, n.s. |         0          1          8         29 |        38

                China |         0          9        169        175 |       353

            Hong Kong |         0          3         40         39 |        82

               Taiwan |         0          5         60         65 |       130

                Japan |         0         36         31         87 |       154

          South Korea |         0         38        137        150 |       325

             Cambodia |         0          1         15         39 |        55

            Indonesia |         0          1          7         14 |        22

                 Laos |         0          0         16         16 |        32

             Malaysia |         0          0          3         14 |        17

          Philippines |         0         40        322        221 |       583

            Singapore |         0          0          6          3 |         9

             Thailand |         0          6         17         44 |        67

              Vietnam |         0          5        140        157 |       302

          Afghanistan |         0          0          4          8 |        12

                India |         0          3        143        239 |       385

           Bangladesh |         0          0         18         19 |        37

                Burma |         0          0          7          6 |        13

             Pakistan |         0          0         28         47 |        75

                 Iran |         0          1         53         55 |       109

                 Iraq |         0          0         18         19 |        37

     Israel/Palestine |         0          5         15         17 |        37

            Palestine |         0          0         10          0 |        10

               Jordan |         0          0          8          7 |        15

              Lebanon |         0          2         29         15 |        46

         Saudi Arabia |         0          1          5          4 |        10

                Syria |         0          0         11          4 |        15

               Turkey |         0          9         20         26 |        55

    Middle East, n.s. |         0          0          2          3 |         5

              Armenia |         0          0          5         16 |        21

    Asia, n.e.c./n.s. |         0          1         27         24 |        52

      Northern Africa |         0          0          1         10 |        11

Egypt/United Arab Rep |         0          0         26         22 |        48

              Morocco |         0          1          4         17 |        22

                Ghana |         0          0         10         20 |        30

              Nigeria |         0          1          9         23 |        33

             Ethiopia |         0          0          9         17 |        26

                Kenya |         0          0          4          4 |         8

South Africa (Union o |         0          3         14         16 |        33

  Africa, n.s./n.e.c. |         0          2         16         49 |        67

            Australia |         0          1          1         14 |        16

          New Zealand |         0          0          2          6 |         8

      Pacific Islands |         0          5          9         19 |        33

                 Fiji |         0          0          4          6 |        10

Other, n.e.c. and unk |         0         20        121        262 |       403

----------------------+--------------------------------------------+----------

                Total |   117,310        976      5,348     10,076 |   133,710

 

 

. codebook citizen

 

------------------------------------------------------------------------------------

citizen                                                           Citizenship status

------------------------------------------------------------------------------------

 

                  type:  numeric (byte)

                 label:  citizenlbl

 

                 range:  [0,3]                        units:  1

         unique values:  4                        missing .:  0/133710

 

            tabulation:  Freq.   Numeric  Label

                        1.2e+05        0  NIU

                           976         1  Born abroad of American parents

                          5348         2  Naturalized citizen

                         10076         3  Not a citizen

 

* A quick look at a couple of ways to generate an immigrant variable.

 

. generate immigrant=0 if citizen==0

(16400 missing values generated)

 

. replace immigrant=1 if citizen>0

(16400 real changes made)

 

. drop immigrant

 

* this version makes more sense to me, where only citizen==2 and citizen==3 are considered immigrants:

 

. generate immigrant=0 if citizen<2

(15424 missing values generated)

 

. replace immigrant=1 if citizen >=2

(15424 real changes made)

 

. tabulate immigrant citizen

 

           |             Citizenship status

 immigrant |       NIU  Born abro  Naturaliz  Not a cit |     Total

-----------+--------------------------------------------+----------

         0 |   117,310        976          0          0 |   118,286

         1 |         0          0      5,348     10,076 |    15,424

-----------+--------------------------------------------+----------

     Total |   117,310        976      5,348     10,076 |   133,710

 

 

. clear all

 

. use "C:\Users\Michael\Desktop\cps_mar_2000_new_unchanged.dta", clear

 

. by citizen: summarize yrsed if age>20 & age<29

not sorted

r(5);

 

* If you want to use the “by” syntax, you have to sort by those variable(s) first.

 

. sort citizen

 

. by citizen: summarize yrsed if age>20 & age<29

 

------------------------------------------------------------------------------------

-> citizen = NIU

 

    Variable |       Obs        Mean    Std. Dev.       Min        Max

-------------+--------------------------------------------------------

       yrsed |     10886    13.58451    2.199255          0         17

 

------------------------------------------------------------------------------------

-> citizen = Born abroad of American parents

 

    Variable |       Obs        Mean    Std. Dev.       Min        Max

-------------+--------------------------------------------------------

       yrsed |       111    14.08108    2.207982          9         17

 

------------------------------------------------------------------------------------

-> citizen = Naturalized citizen

 

    Variable |       Obs        Mean    Std. Dev.       Min        Max

-------------+--------------------------------------------------------

       yrsed |       391    13.38491    2.928998          0         17

 

------------------------------------------------------------------------------------

-> citizen = Not a citizen

 

    Variable |       Obs        Mean    Std. Dev.       Min        Max

-------------+--------------------------------------------------------

       yrsed |      2054    11.02872    3.763516          0         17

 

 

* Table can do a lot of the things that summarize does.

 

. table citizen if age >20 & age<29, contents (mean yrsed)

 

---------------------------------------------

             Citizenship status | mean(yrsed)

--------------------------------+------------

                            NIU |    13.58451

Born abroad of American parents |    14.08108

            Naturalized citizen |    13.38491

                  Not a citizen |    11.02872

---------------------------------------------

 

. tabulate citizen

 

             Citizenship status |      Freq.     Percent        Cum.

--------------------------------+-----------------------------------

                            NIU |    117,310       87.73       87.73

Born abroad of American parents |        976        0.73       88.46

            Naturalized citizen |      5,348        4.00       92.46

                  Not a citizen |     10,076        7.54      100.00

--------------------------------+-----------------------------------

                          Total |    133,710      100.00

 

. tabulate citizen if yrsed >=12

 

             Citizenship status |      Freq.     Percent        Cum.

--------------------------------+-----------------------------------

                            NIU |    100,860       90.34       90.34

Born abroad of American parents |        821        0.74       91.08

            Naturalized citizen |      3,980        3.56       94.64

                  Not a citizen |      5,981        5.36      100.00

--------------------------------+-----------------------------------

                          Total |    111,642      100.00

 

* Sometimes you need to make 2 tables to get the numerator and the denominator to answer the question, so you can use the “display” function or your own calculator to get the percentage that way.

 

. display 100860/117310

.85977325

 

. log close

      name:  <unnamed>

       log:  C:\Users\Michael\Documents\newer web pages\soc_meth_proj3\soc_180B_win2

> 013\class3.log

  log type:  text

 closed on:  17 Jan 2013, 16:17:15

------------------------------------------------------------------------------------