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

st: How to extract and recode variables in a multiple member household survey


From   ra248@columbia.edu
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: How to extract and recode variables in a multiple member household survey
Date   Thu, 10 Feb 2005 17:02:32 -0500

Dear Statalisters,

I have the following problem.  I am working with a household survey
and I need to separate the information of the mother.  I have a set
of variables recording a set of characteristics for each household
member. For instance, variable S_i (where i=1,,46) records the sex
of the ith member. Variable A_i records the age of the ith member
and so on.  I also have a variable that takes the value of i for
the mother in the household.

My dataset looks like this:

ID   Mom   S_1   A_1   S_2   A_2   S_3   A_3   S_46   A_46
1	2   M     24	  F	22	F    12	     M  	67
2	1   F	   29	  M	32	M     8	     .	       .
3	46  F	   76    M	75	F    46	     F	       41
.
.

What I need is to identify the mother in each row and create a set
of separate variables for her  (i.e. MS, MA), while at the same
time deleting the original mother observation from the original
data set of variables (shown below).


ID  Mom  S_1   A_1   S_2   A_2   S_3   A_3   S_46   A_46   MS	MA
1   2	   M	 24	.	.     F    12	    M	    67	   F	22
2   1	   .	  .	M     32     M     8     .	     .    F	29
3  46	   F	 76	M     75     F    46	    .	     .    F	41

 Any tips or suggestions on how to do this are greatly appreciated.
Ive tried a couple of things using the forvalues command and
searched the FAQs but I m not heading in the right direction.

Many thanks,

Regina Almeyda-Duran




*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index