Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Creating variables describing parents' characteristics with parents' ID


From   [email protected]
To   [email protected]
Subject   st: Creating variables describing parents' characteristics with parents' ID
Date   14 Mar 2009 18:04:47 -0500

Hello Stata Users,

I'm sorry if you already got this email. I'm resending it because I am not 
sure if it went out correctly.
It is the first time I send a question to statalist serv. 
Please execuse me if I made some mistakes or violated common rules.
 
I would like to generate a new variable which contains the information of 
parents, e.g. dad's education.
My data looks like below.

FID	PID	Var1	Edu	Var3	Dad's FID  Dad's PID  Dad's Edu
1001	10	1	3	5	.	        .	
1001	20	3	3	2	.		.	
1001	30	4	2	3	1001	        10	 3
1001	31	8	5	5	1001		10	 3
1002	1	2	4	3	.		.	 .
1002	10	4	2	1	1002		1	 4
1002	20	5	4	2	.		.	 .
1002	30	9	3	2	1002		10	 2
1002	31	6	1	4	1002		10	 2
1002	32	4	2	5	1002		10	 2

Note: FID = Family ID; PID = Person ID; Edu = Educational attainment
(Values are randomly assigned, but data structure is similar to the above.)
 
What I want to do is to have the last (far left) column, which is not 
included in the dataset. (I want to do this kind of works for other 
variables, e.g. Var1 and Var3.)
What is the best & simplist way to do this in stata? 

I think I can do this like the following.
1) Split the data set into two files so that one file contains Dad's FID 
and Dad's PID, and the other has all others.
2) Then, rename FID and PID in the second file as Dad's FID and Dad's PID.
3) Rename Edu (and/or other variables I want to have at Dad's level) as 
Dad's Edu
4) Merge two files by matching Dad's FID and Dad's PID.

However, I think there might be easier way to do this.
Please let me know if you know anything that makes the work easier.
 
Thanks much, in advance.
 


Eunsu Ju
 
Ph.D. Candidate, Research Specialist
School of Social Work, University of Minnesota


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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