Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Construct a new variable


From   "Rodrigo Brice�o" <[email protected]>
To   "Statalist \(E-mail\)" <[email protected]>
Subject   st: Construct a new variable
Date   Thu, 30 Jan 2003 15:16:54 -0600

Dear Stata Users: I need some assistance in the construction of a new
variable. I really don't know how to construct it, because the sintaxis is a
little complex for my knowledge of Stata. I will thank a lot everybody who
can help me. Lets take an Example:

Household       MN       SEX      AGE     REL     CIVIL     SS1  SS2
1001008021	1	1	37	1	1	1       1
1001008021	2	2	32	2	1	.        3
1001008021	3	1	12	3	6	.
1001008021	4	1	5	3	6	.        4
1001008031	1	2	42	1	1	.        3
1001008031	2	2	25	2	1	1       1
1001008031	3	2	18	3	6	1       2
1001008031	4	2	20	3	6	1       2
1001008031	5	1	4	3	6	1       2


I want to generate the variable SS2 with those values. The logic is the
next:

1. SS2 will have an 1 if SS1=1 and if the person in that household is
married or have sons (civil=1 or if the person have dependants: rel=3).
2. SS2 wil have a 2 if SS1=1 and if the person if a son (rel=3) and age>=10.
3. SS2 will have a 3 if rel=1 or rel=2 have SS1=1, and SS1 for this person
is missing. We are trying to assign values to the husbands or wifes whose
partner have SS=1.
4. SS2 will have a 4 if reljefe=1 or 2, SS=1 (for any of them or both) and
they have chldren less or equal to 5 (rel=3 and age<=5).

Thanks for your precious time

Rodrigo



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index