Statalist


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

st: Creating variables of parents education when ID is known


From   Eunsu Ju <[email protected]>
To   [email protected]
Subject   st: Creating variables of parents education when ID is known
Date   Sun, 15 Mar 2009 02:47:28 -0500

Hello Stata Users,

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 FFID FPID Fedu

 1001 100  XXX  XXX XXXX   ----   ----   ????
 1001 200  XXX  XXX XXXX   ----   ----   ????
 1001 300  XXX  XXX XXXX 1001  100  ????
 1001 310  XXX  XXX XXXX 1001  100  ????
 1002 101  XXX  XXX XXXX   ----   ----   ????
 1002 102  XXX  XXX XXXX   ----   ----   ????
 1002 200  XXX  XXX XXXX 1002  101  ????
 1002 300  XXX  XXX XXXX 1002  101  ????
 1002 310  XXX  XXX XXXX 1002  200  ????
 1002 320  XXX  XXX XXXX 1002  200  ????


*Note: FID = Family ID; PID = Person ID; FFID = Father's family ID;
          FPID = Father's person ID; Fedu = Father's Education


What I want to do is to have the last (far right) 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, 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