Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Antonio Rodriguez Andres" <Antonio.Andres@emu.edu.tr> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: Creating a dummy variable and age of children |
Date | Tue, 28 Jan 2014 20:41:51 +0200 |
Dear Stata users, I am using data from the ESS. There are two variables in the dataset related to children Children living at home (CHLDHM), and there is another called number of children ever given birth to/fathered (NBTHCLD), ranging from 0 to 31. The thing is that I want to control for the presence of children below 5yrs, below 16 years etc. The individual identifier is this dataset is idno. Other researchers seems to use the information collected from 15 variables related to the household member (second person in household: relationship to respondent; third person in Household;... fifteenth person in household: relation to respondent). This variable takes values from 1 to 6 (where 2= Son/daughther etc). The survey also ask about the year of birth of this household member (Year of birth of second person in household; year of birth of third person in household; .; year of birth of fifteenth person in household) second person in household: | relationship to respondent | Freq. Percent Cum. -----------------------------------+----------------------------------- Husband/wife/partner | 21,868 74.12 74.12 Son/daughter/step/adopted/foster | 2,103 7.13 81.25 Parent/parent-in-law | 4,425 15.00 96.24 Brother/sister/step/adopted/foster | 310 1.05 97.30 Other relative | 498 1.69 98.98 Other non-relative | 300 1.02 100.00 -----------------------------------+----------------------------------- Total | 29,504 100.00 tab YRBRN2 if RSHIPA2==2 Year of birth | of second | person in | household | Freq. Percent Cum. ---------------+----------------------------------- 1939 | 1 0.05 0.05 1941 | 1 0.05 0.10 1946 | 1 0.05 0.14 1949 | 2 0.10 0.24 1951 | 1 0.05 0.29 1952 | 3 0.14 0.43 1953 | 1 0.05 0.48 1954 | 4 0.19 0.67 1955 | 5 0.24 0.91 1956 | 6 0.29 1.20 1957 | 8 0.38 1.58 1958 | 8 0.38 1.97 1959 | 12 0.58 2.54 1960 | 12 0.58 3.12 1961 | 15 0.72 3.84 1962 | 8 0.38 4.22 1963 | 14 0.67 4.89 1964 | 22 1.06 5.95 1965 | 21 1.01 6.95 1966 | 18 0.86 7.82 1967 | 22 1.06 8.87 1968 | 21 1.01 9.88 1969 | 20 0.96 10.84 1970 | 13 0.62 11.46 1971 | 29 1.39 12.85 1972 | 24 1.15 14.00 1973 | 30 1.44 15.44 1974 | 24 1.15 16.59 1975 | 29 1.39 17.99 1976 | 25 1.20 19.18 1977 | 30 1.44 20.62 1978 | 33 1.58 22.21 1979 | 31 1.49 23.69 1980 | 50 2.40 26.09 1981 | 50 2.40 28.49 1982 | 47 2.25 30.74 1983 | 61 2.93 33.67 1984 | 57 2.73 36.40 1985 | 55 2.64 39.04 1986 | 69 3.31 42.35 1987 | 70 3.36 45.71 1988 | 71 3.41 49.11 1989 | 109 5.23 54.34 1990 | 81 3.88 58.23 1991 | 87 4.17 62.40 1992 | 83 3.98 66.38 1993 | 90 4.32 70.70 1994 | 65 3.12 73.81 1995 | 72 3.45 77.27 1996 | 70 3.36 80.62 1997 | 57 2.73 83.36 1998 | 42 2.01 85.37 1999 | 51 2.45 87.82 2000 | 57 2.73 90.55 2001 | 33 1.58 92.13 2002 | 53 2.54 94.68 2003 | 40 1.92 96.59 2004 | 29 1.39 97.99 2005 | 19 0.91 98.90 2006 | 22 1.06 99.95 2007 | 1 0.05 100.00 ---------------+----------------------------------- Total | 2,085 100.00 The idea is to create a dummy variable for children living in the household < 5Years and the age of children for the rest of household members (third person in household, ...) Regards Antonio * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/