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

       log:  C:\AAA Miker Files\newer web pages\soc_meth_proj3\section

> 1_2009_log.log

  log type:  text

 opened on:  27 Jan 2009, 15:32:43

 

. 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 [fweight= perwt_rounded]

 

             Citizenship status |      Freq.     Percent        Cum.

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

                            NIU |243,819,499       88.96       88.96

Born abroad of American parents |  1,889,032        0.69       89.65

            Naturalized citizen | 10,621,538        3.88       93.52

                  Not a citizen | 17,757,752        6.48      100.00

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

                          Total |274,087,821      100.00

 

. *let's say we want to add these 3 numbers together, meaning 3 categories of immigrants.

 

. *Or maybe we mean only 2 categories, the last 2.

 

. tabulate citizen, nolabel

 

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

 

*tabulate with no label to get the codes. Or look them up on ipums.

 

. tabulate citizen if citizen ~=0 & citizen~=1 [fweight= perwt_rounded]

 

             Citizenship status |      Freq.     Percent        Cum.

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

            Naturalized citizen | 10,621,538       37.43       37.43

                  Not a citizen | 17,757,752       62.57      100.00

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

                          Total | 28,379,290      100.00

 

. *There were about 28 million immigrants in US in March, 2000

 

. display 10621538+17757752

28379290

 

*display is a command like a hand calculator. You feed it a mathematical expression, it gives you the result.

 

. 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, 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

 

. generate byte immigrant= 1 if citizen<2

(15424 missing values generated)

 

*generate is the function that makes new variables. The byte option just says that the values of this variable are going to be small integers.

 

. replace immigrant=2 if citizen>1

(15424 real changes made)

 

. label define imig_lbl 1 "US native" 2 "immigrant"

 

*Create a label that associates 1 with “US Native,” 2 with “immigrant”

 

. label val immigrant imig_lbl

 

. tabulate citizen immigrant

 

                      |       immigrant

   Citizenship status | US native  immigrant |     Total

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

                  NIU |   117,310          0 |   117,310

Born abroad of Americ |       976          0 |       976

  Naturalized citizen |         0      5,348 |     5,348

        Not a citizen |         0     10,076 |    10,076

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

                Total |   118,286     15,424 |   133,710

 

*tabulating 2 variables, called cross tabulation, is a great way to make sure that the new variable does what you want it to do.

 

. label variable immigrant "citizen or not, based on citizen, born abroad of US parents coded as native"

 

. tabulate citizen immigrant

 

                      | citizen or not, based

                      |   on citizen, born

                      | abroad of US parents

                      |    coded as native

   Citizenship status | US native  immigrant |     Total

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

                  NIU |   117,310          0 |   117,310

Born abroad of Americ |       976          0 |       976

  Naturalized citizen |         0      5,348 |     5,348

        Not a citizen |         0     10,076 |    10,076

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

                Total |   118,286     15,424 |   133,710

 

*The people who were born abroad of American parents, where were they born?

 

. tabulate citizen bpl if citizen==1

 

                      |      Birthplace

   Citizenship status |    Canada    Bermuda |     Total

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

Born abroad of Americ |       102          2 |       976

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

                Total |       102          2 |       976

 

 

                      |      Birthplace

   Citizenship status |    Mexico  Costa Ric |     Total

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

Born abroad of Americ |       155          1 |       976

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

                Total |       155          1 |       976

 

 

                      |      Birthplace

   Citizenship status | El Salvad  Guatemala |     Total

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

Born abroad of Americ |        13          1 |       976

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

                Total |        13          1 |       976

--Break--

r(1);

 

*Let me orient this crosstabulation in a more reasonable way, so that the variable with many categories runs down the page, rather than across.

 

. tabulate bpl citizen if citizen==1

 

                      | Citizenshi

                      |  p status

           Birthplace | Born abro |     Total

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

               Canada |       102 |       102

              Bermuda |         2 |         2

               Mexico |       155 |       155

           Costa Rica |         1 |         1

          El Salvador |        13 |        13

            Guatemala |         1 |         1

             Honduras |         5 |         5

            Nicaragua |         5 |         5

               Panama |        13 |        13

Central America, n.s. |         3 |         3

                 Cuba |         5 |         5

   Dominican Republic |         6 |         6

              Jamaica |         3 |         3

              Bahamas |         3 |         3

             Barbados |         1 |         1

              Grenada |         1 |         1

  Trinidad and Tobago |         1 |         1

      Caribbean, n.s. |         3 |         3

            Argentina |         2 |         2

               Brazil |         3 |         3

                Chile |         3 |         3

             Colombia |         5 |         5

              Ecuador |         3 |         3

Guyana/British Guiana |         1 |         1

                 Peru |         3 |         3

            Venezuela |         8 |         8

  South America, n.s. |         1 |         1

              Denmark |         1 |         1

              Finland |         1 |         1

               Norway |         4 |         4

               Sweden |         3 |         3

              England |        72 |        72

             Scotland |         7 |         7

 United Kingdom, n.s. |         2 |         2

              Ireland |         4 |         4

              Belgium |         5 |         5

               France |        26 |        26

          Netherlands |         4 |         4

          Switzerland |         1 |         1

               Greece |         1 |         1

                Italy |        25 |        25

             Portugal |         4 |         4

               Azores |         2 |         2

                Spain |        14 |        14

              Austria |         2 |         2

              Germany |       234 |       234

               Poland |         7 |         7

           Yugoslavia |         1 |         1

    Other USSR/Russia |         4 |         4

         Europe, n.s. |         1 |         1

                China |         9 |         9

            Hong Kong |         3 |         3

               Taiwan |         5 |         5

                Japan |        36 |        36

          South Korea |        38 |        38

             Cambodia |         1 |         1

            Indonesia |         1 |         1

          Philippines |        40 |        40

             Thailand |         6 |         6

              Vietnam |         5 |         5

                India |         3 |         3

                 Iran |         1 |         1

     Israel/Palestine |         5 |         5

              Lebanon |         2 |         2

         Saudi Arabia |         1 |         1

               Turkey |         9 |         9

    Asia, n.e.c./n.s. |         1 |         1

              Morocco |         1 |         1

              Nigeria |         1 |         1

South Africa (Union o |         3 |         3

  Africa, n.s./n.e.c. |         2 |         2

            Australia |         1 |         1

      Pacific Islands |         5 |         5

Other, n.e.c. and unk |        20 |        20

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

                Total |       976 |       976

 

 

. *This is the answer to where people are born who say they were born abroad to US parents.

 

. tabulate bpl citizen if citizen==1 [fweight= perwt_rounded]

 

                      | Citizenshi

                      |  p status

           Birthplace | Born abro |     Total

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

               Canada |   201,297 |   201,297

              Bermuda |     4,821 |     4,821

               Mexico |   227,485 |   227,485

           Costa Rica |     1,281 |     1,281

          El Salvador |    19,791 |    19,791

            Guatemala |     2,073 |     2,073

             Honduras |     5,345 |     5,345

            Nicaragua |     7,795 |     7,795

               Panama |    24,222 |    24,222

Central America, n.s. |     3,846 |     3,846

                 Cuba |     5,076 |     5,076

   Dominican Republic |     7,334 |     7,334

              Jamaica |    11,717 |    11,717

              Bahamas |     5,595 |     5,595

             Barbados |     2,565 |     2,565

              Grenada |     2,339 |     2,339

  Trinidad and Tobago |       494 |       494

      Caribbean, n.s. |     4,967 |     4,967

            Argentina |     2,258 |     2,258

               Brazil |     3,876 |     3,876

                Chile |     3,318 |     3,318

             Colombia |     5,173 |     5,173

              Ecuador |     5,333 |     5,333

Guyana/British Guiana |       237 |       237

                 Peru |     5,667 |     5,667

            Venezuela |    14,523 |    14,523

  South America, n.s. |     1,299 |     1,299

              Denmark |       361 |       361

              Finland |     2,355 |     2,355

               Norway |     3,548 |     3,548

               Sweden |     5,418 |     5,418

              England |   126,778 |   126,778

             Scotland |    13,238 |    13,238

 United Kingdom, n.s. |     4,920 |     4,920

              Ireland |     8,603 |     8,603

              Belgium |     6,185 |     6,185

               France |    63,278 |    63,278

          Netherlands |    11,124 |    11,124

          Switzerland |       441 |       441

               Greece |     1,999 |     1,999

                Italy |    49,454 |    49,454

             Portugal |     7,195 |     7,195

               Azores |     4,971 |     4,971

                Spain |    22,571 |    22,571

              Austria |     1,465 |     1,465

              Germany |   494,206 |   494,206

               Poland |    13,357 |    13,357

           Yugoslavia |       428 |       428

    Other USSR/Russia |     6,157 |     6,157

         Europe, n.s. |     1,974 |     1,974

                China |    26,544 |    26,544

            Hong Kong |     6,419 |     6,419

               Taiwan |     8,539 |     8,539

                Japan |    83,683 |    83,683

          South Korea |   100,372 |   100,372

             Cambodia |       229 |       229

            Indonesia |     3,221 |     3,221

          Philippines |    91,335 |    91,335

             Thailand |    13,200 |    13,200

              Vietnam |     9,323 |     9,323

                India |     3,434 |     3,434

                 Iran |     4,351 |     4,351

     Israel/Palestine |    12,577 |    12,577

              Lebanon |     4,751 |     4,751

         Saudi Arabia |     2,069 |     2,069

               Turkey |    16,625 |    16,625

    Asia, n.e.c./n.s. |     3,143 |     3,143

              Morocco |     3,065 |     3,065

              Nigeria |     2,795 |     2,795

South Africa (Union o |    10,999 |    10,999

  Africa, n.s./n.e.c. |     7,403 |     7,403

            Australia |     3,501 |     3,501

      Pacific Islands |    11,590 |    11,590

Other, n.e.c. and unk |    30,111 |    30,111

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

                Total | 1,889,032 | 1,889,032

 

 

. *Because we have added a variable, called immigrant, we would definitely want to save the dataset before quitting. In my case, because this is just a classroom demonstration, I won't bother.

 

. clear all

 

. exit, clear