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

      name:  <unnamed>

       log:  C:\Documents and Settings\Michael Rosenfeld\My Documents\newer web pages\soc_meth_proj3\2010_logs\second_class.log

  log type:  text

 opened on:  28 Jan 2010, 14:19:45

 

* first things first, open up a text log

 

. *we are going to read in a data file. Step 1 is change directory

 

. cd "C:\Documents and Settings\Michael Rosenfeld\trial data"

unable to change to C:\Documents and Settings\Michael Rosenfeld\trial data

r(170);

 

. *I guess I already had the directory set

 

. do "C:\Documents and Settings\Michael Rosenfeld\My Documents\trial data\cps_00005.do"

 

* the do command above is activated from the menus, so I don’t have to type the directory in…

 

*Stata reads in the do-file, and executes it step by step.

 

. /* Important: you need to put the .dat and .do files in one folder/

>    directory and then set the working folder to that folder. */

.

. set more off

 

.

. clear

 

. infix ///

>  int     year                                 1-4 ///

>  byte    age                                  5-6 ///

>  byte    sex                                  7 ///

>  using cps_00005.dat

(210648 observations read)

 

.

. label var year `"Survey year"'

 

. label var age `"Age"'

 

. label var sex `"Sex"'

 

.

. label define agelbl 00 `"Under 1 year"'

 

. label define agelbl 01 `"1"', add

 

. label define agelbl 02 `"2"', add

 

. label define agelbl 03 `"3"', add

 

. label define agelbl 04 `"4"', add

 

. label define agelbl 05 `"5"', add

 

. label define agelbl 06 `"6"', add

 

. label define agelbl 07 `"7"', add

 

. label define agelbl 08 `"8"', add

 

. label define agelbl 09 `"9"', add

 

. label define agelbl 10 `"10"', add

 

. label define agelbl 11 `"11"', add

 

. label define agelbl 12 `"12"', add

 

. label define agelbl 13 `"13"', add

 

. label define agelbl 14 `"14"', add

 

. label define agelbl 15 `"15"', add

 

. label define agelbl 16 `"16"', add

 

. label define agelbl 17 `"17"', add

 

. label define agelbl 18 `"18"', add

 

. label define agelbl 19 `"19"', add

 

. label define agelbl 20 `"20"', add

 

. label define agelbl 21 `"21"', add

 

. label define agelbl 22 `"22"', add

 

. label define agelbl 23 `"23"', add

 

. label define agelbl 24 `"24"', add

 

. label define agelbl 25 `"25"', add

 

. label define agelbl 26 `"26"', add

 

. label define agelbl 27 `"27"', add

 

. label define agelbl 28 `"28"', add

 

. label define agelbl 29 `"29"', add

 

. label define agelbl 30 `"30"', add

 

. label define agelbl 31 `"31"', add

 

. label define agelbl 32 `"32"', add

 

. label define agelbl 33 `"33"', add

 

. label define agelbl 34 `"34"', add

 

. label define agelbl 35 `"35"', add

 

. label define agelbl 36 `"36"', add

 

. label define agelbl 37 `"37"', add

 

. label define agelbl 38 `"38"', add

 

. label define agelbl 39 `"39"', add

 

. label define agelbl 40 `"40"', add

 

. label define agelbl 41 `"41"', add

 

. label define agelbl 42 `"42"', add

 

. label define agelbl 43 `"43"', add

 

. label define agelbl 44 `"44"', add

 

. label define agelbl 45 `"45"', add

 

. label define agelbl 46 `"46"', add

 

. label define agelbl 47 `"47"', add

 

. label define agelbl 48 `"48"', add

 

. label define agelbl 49 `"49"', add

 

. label define agelbl 50 `"50"', add

 

. label define agelbl 51 `"51"', add

 

. label define agelbl 52 `"52"', add

 

. label define agelbl 53 `"53"', add

 

. label define agelbl 54 `"54"', add

 

. label define agelbl 55 `"55"', add

 

. label define agelbl 56 `"56"', add

 

. label define agelbl 57 `"57"', add

 

. label define agelbl 58 `"58"', add

 

. label define agelbl 59 `"59"', add

 

. label define agelbl 60 `"60"', add

 

. label define agelbl 61 `"61"', add

 

. label define agelbl 62 `"62"', add

 

. label define agelbl 63 `"63"', add

 

. label define agelbl 64 `"64"', add

 

. label define agelbl 65 `"65"', add

 

. label define agelbl 66 `"66"', add

 

. label define agelbl 67 `"67"', add

 

. label define agelbl 68 `"68"', add

 

. label define agelbl 69 `"69"', add

 

. label define agelbl 70 `"70"', add

 

. label define agelbl 71 `"71"', add

 

. label define agelbl 72 `"72"', add

 

. label define agelbl 73 `"73"', add

 

. label define agelbl 74 `"74"', add

 

. label define agelbl 75 `"75"', add

 

. label define agelbl 76 `"76"', add

 

. label define agelbl 77 `"77"', add

 

. label define agelbl 78 `"78"', add

 

. label define agelbl 79 `"79"', add

 

. label define agelbl 80 `"80"', add

 

. label define agelbl 81 `"81"', add

 

. label define agelbl 82 `"82"', add

 

. label define agelbl 83 `"83"', add

 

. label define agelbl 84 `"84"', add

 

. label define agelbl 85 `"85"', add

 

. label define agelbl 86 `"86"', add

 

. label define agelbl 87 `"87"', add

 

. label define agelbl 88 `"88"', add

 

. label define agelbl 89 `"89"', add

 

. label define agelbl 90 `"90 (90+, 1988-2002)"', add

 

. label define agelbl 91 `"91"', add

 

. label define agelbl 92 `"92"', add

 

. label define agelbl 93 `"93"', add

 

. label define agelbl 94 `"94"', add

 

. label define agelbl 95 `"95"', add

 

. label define agelbl 96 `"96"', add

 

. label define agelbl 97 `"97"', add

 

. label define agelbl 98 `"98"', add

 

. label define agelbl 99 `"99+"', add

 

. label values age agelbl

 

.

. label define sexlbl 1 `"Male"'

 

. label define sexlbl 2 `"Female"', add

 

. label values sex sexlbl

 

.

.

end of do-file

 

. *First thing we want to do is save it

 

. save "C:\Documents and Settings\Michael Rosenfeld\My Documents\trial data\sample dataset 2.dta"

file C:\Documents and Settings\Michael Rosenfeld\My Documents\trial data\sample d

> ataset 2.dta saved

 

. *But I don'

 

. *but I don't want to use this data at the moment

 

. clear

 

* clear gets rid of the dataset in memory, so you can load another. Be sure to save before you clear…

 

. use "C:\Documents and Settings\Michael Rosenfeld\Desktop\cps_mar_2000_new.dta", clear

 

* use is activiated via the menus, menu command File>Open

 

. tabulate  educ99

 

          Educational attainment, 1990 |      Freq.     Percent        Cum.

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

                                   NIU |     30,484       22.80       22.80

                   No school completed |        457        0.34       23.14

                         1st-4th grade |      1,187        0.89       24.03

                         5th-8th grade |      6,847        5.12       29.15

                             9th grade |      4,161        3.11       32.26

                            10th grade |      4,695        3.51       35.77

                            11th grade |      4,721        3.53       39.30

                12th grade, no diploma |      1,491        1.12       40.42

          High school graduate, or GED |     31,970       23.91       64.33

               Some college, no degree |     18,797       14.06       78.39

Associate degree, occupational program |      3,758        2.81       81.20

    Associate degree, academic program |      3,328        2.49       83.69

                      Bachelors degree |     14,705       11.00       94.68

                        Masters degree |      4,918        3.68       98.36

                   Professional degree |      1,229        0.92       99.28

                      Doctorate degree |        962        0.72      100.00

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

                                 Total |    133,710      100.00

 

. tabulate  educ99, nolab

 

Educational |

attainment, |

       1990 |      Freq.     Percent        Cum.

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

          0 |     30,484       22.80       22.80

          1 |        457        0.34       23.14

          4 |      1,187        0.89       24.03

          5 |      6,847        5.12       29.15

          6 |      4,161        3.11       32.26

          7 |      4,695        3.51       35.77

          8 |      4,721        3.53       39.30

          9 |      1,491        1.12       40.42

         10 |     31,970       23.91       64.33

         11 |     18,797       14.06       78.39

         12 |      3,758        2.81       81.20

         13 |      3,328        2.49       83.69

         14 |     14,705       11.00       94.68

         15 |      4,918        3.68       98.36

         16 |      1,229        0.92       99.28

         17 |        962        0.72      100.00

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

      Total |    133,710      100.00

 

* The point above is that the numeric values for educ99 don’t actually correspond to years of education. For that, we need another variable, yrsed. You can see below that yrsed gives us the actual number of years for each category.

 

 

. table  educ99, contents (mean yrsed)

 

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

          Educational attainment, 1990 | mean(yrsed)

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

                                   NIU |           

                   No school completed |           0

                         1st-4th grade |         2.5

                         5th-8th grade |         6.5

                             9th grade |           9

                            10th grade |          10

                            11th grade |          11

 

                12th grade, no diploma |          12

          High school graduate, or GED |          12

               Some college, no degree |          14

Associate degree, occupational program |          14

    Associate degree, academic program |          14

                      Bachelors degree |          17

                        Masters degree |          17

                   Professional degree |          17

                      Doctorate degree |          17

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

 

. *unlike educ99, yrsed has the real number of years of education, and that allows us to do operations like take the average

 

. table race if age>25 & age<50, contents(freq mean yrsed)

 

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

                        Race |       Freq.  mean(yrsed)

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

                       White |      40,593     13.45296

                 Black/Negro |       4,690     13.23444

American Indian/Aleut/Eskimo |         640     12.70078

   Asian or Pacific Islander |       1,852     14.29293

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

 

. table race if age>25 & age<50 [fweight= perwt_rounded], contents(freq mean yrsed)

 

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

                        Race |       Freq.  mean(yrsed)

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

                       White |    8.10e+07     13.62884

                 Black/Negro |    1.26e+07     13.24369

American Indian/Aleut/Eskimo |     909,466     12.74797

   Asian or Pacific Islander |     4320060     14.40249

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

 

. *unlike summarize, which had a little bug when using weights, table gives us the right numbers when using the weights.

 

. tabulate hispan race

 

                      |                    Race

      Hispanic origin |     White  Black/Neg  American   Asian or  |     Total

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

         Not Hispanic |    89,551     12,885      1,646      4,559 |   108,641

     Mexican American |     6,337         29         73          8 |     6,447

      Chicano/Chicana |       360          0         17          7 |       384

   Mexican (Mexicano) |     7,970         55        109         21 |     8,155

         Puerto Rican |     2,057        169         19         35 |     2,280

                Cuban |       905         34          0          4 |       943

        Other Spanish |     1,652        171         15         25 |     1,863

Central/South America |     3,206        238         12         31 |     3,487

          Do not know |       461          2          0          8 |       471

N/A (and no response  |       976         43          3         17 |     1,039

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

                Total |   113,475     13,626      1,894      4,715 |   133,710

 

 

. *to answer the question, what percentage of Mexican Americans in the dataset are white?

 

. display 6337/6447

.9829378

 

. tabulate hispan race, row col

 

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

| Key               |

|-------------------|

|     frequency     |

|  row percentage   |

| column percentage |

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

 

                      |                    Race

      Hispanic origin |     White  Black/Neg  American   Asian or  |     Total

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

         Not Hispanic |    89,551     12,885      1,646      4,559 |   108,641

                      |     82.43      11.86       1.52       4.20 |    100.00

                      |     78.92      94.56      86.91      96.69 |     81.25

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

     Mexican American |     6,337         29         73          8 |     6,447

                      |     98.29       0.45       1.13       0.12 |    100.00

                      |      5.58       0.21       3.85       0.17 |      4.82

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

      Chicano/Chicana |       360          0         17          7 |       384

                      |     93.75       0.00       4.43       1.82 |    100.00

                      |      0.32       0.00       0.90       0.15 |      0.29

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

   Mexican (Mexicano) |     7,970         55        109         21 |     8,155

                      |     97.73       0.67       1.34       0.26 |    100.00

                      |      7.02       0.40       5.76       0.45 |      6.10

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

         Puerto Rican |     2,057        169         19         35 |     2,280

                      |     90.22       7.41       0.83       1.54 |    100.00

                      |      1.81       1.24       1.00       0.74 |      1.71

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

                Cuban |       905         34          0          4 |       943

                      |     95.97       3.61       0.00       0.42 |    100.00

                      |      0.80       0.25       0.00       0.08 |      0.71

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

        Other Spanish |     1,652        171         15         25 |     1,863

                      |     88.67       9.18       0.81       1.34 |    100.00

                      |      1.46       1.25       0.79       0.53 |      1.39

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

Central/South America |     3,206        238         12         31 |     3,487

                      |     91.94       6.83       0.34       0.89 |    100.00

                      |      2.83       1.75       0.63       0.66 |      2.61

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

          Do not know |       461          2          0          8 |       471

                      |     97.88       0.42       0.00       1.70 |    100.00

                      |      0.41       0.01       0.00       0.17 |      0.35

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

N/A (and no response  |       976         43          3         17 |     1,039

                      |     93.94       4.14       0.29       1.64 |    100.00

                      |      0.86       0.32       0.16       0.36 |      0.78

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

                Total |   113,475     13,626      1,894      4,715 |   133,710

                      |     84.87      10.19       1.42       3.53 |    100.00

                      |    100.00     100.00     100.00     100.00 |    100.00

 

 

. table sex if age>19 & age<40 &  incwage>0 &   incwage!=., contents (freq mean incwage)

 

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

      Sex |         Freq.  mean(incwage)

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

     Male |        16,234     31833.0053

   Female |        14,777     21108.4955

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

 

. table sex if age>19 & age<40 &  incwage>0 &   incwage!=. [fweight= perwt_rounded], contents (freq mean incwage)

 

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

      Sex |         Freq.  mean(incwage)

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

     Male |      3.42e+07    32581.24358

   Female |      3.08e+07    21614.92986

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

 

. tabulate  occ1990 if  occ1990==178

 

                 Occupation, 1990 basis |      Freq.     Percent        Cum.

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

                                Lawyers |        441      100.00      100.00

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

                                  Total |        441      100.00

 

. table sex if age>19 & age<40 &  incwage>0 &   incwage!=. & occ1990==178 [fweight= perwt_rounded] , contents (freq mean incwage)

 

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

      Sex |         Freq.  mean(incwage)

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

     Male |       206,905    77306.40419

   Female |       155,157    56478.93459

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

 

. table sex if age>19 & age<40 &  incwage>0 &   incwage!=. & occ1990==178 [fweight= perwt_rounded] , contents (freq mean incwage med incwage)

 

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

      Sex |         Freq.  mean(incwage)   med(incwage)

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

     Male |       206,905    77306.40419          64000

   Female |       155,157    56478.93459          46000

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

 

 

. table sex if age>19 & age<40 &  incwage>0 &   incwage!=. & occ1990==178 [fweight= perwt_rounded] , contents (freq mean incwage med incwage)

 

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

      Sex |         Freq.  mean(incwage)   med(incwage)

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

     Male |       206,905    77306.40419          64000

   Female |       155,157    56478.93459          46000

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

 

. table sex if age>19 & age<40 &  incwage>0 &   incwage!=. & occ1990==178 , contents (freq mean incwage med incwage)

 

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

      Sex |         Freq.  mean(incwage)   med(incwage)

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

     Male |            91    78716.98901          65000

   Female |            62    56600.29032          48250

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

 

*And here without weights. Is 153 a large enough sample size to be sure that the income difference between male and female lawyers is real? How sure are we that with a different CPS sized sample, resulting in a different 153 male and female lawyers, that the men would earn more? That kind of question is the one this class will be answering.

 

 

. clear

 

. exit, clear

 

* I activated the menu File>Exit