Support #252
closedData on parents of children in c_child.dta
100%
Description
I'm working with the Wave 3 data (eventually, I'll look into the three waves but for the moment, I'm at a preliminary cross-sectional analysis stage).
I want to get some descriptive characteristics of the parents of the children in the c_child.dta dataset (say, their ages and employment status).
The problem is that when I merge c_child.dta with c_indresp I get no matched records. I was suggested to identify the pidp of the parents via the variable c_relationship_dv in the c_egoalt.dta dataset, which I did. But even merging this new dataset with c_indresp leaves me with no records.
Could anyone help me with this, please?
Many thanks,
José
PS: a simple code is:
use "XXX\c_child.dta", clear
sort c_hidp
merge 1:m c_hidp pidp "XXX\c_indresp.dta"
or,
use "XXX\c_egoalt.dta", clear
keep if ( c_relationship_dv>8 & c_relationship_dv<13)
save "XXX\red.dta", replace
sort c_hidp
merge 1:m c_hidp pidp "XXX\c_indresp.dta"
Updated by Redmine Admin over 10 years ago
- % Done changed from 0 to 50
CHILD is constructed as the subset of 0-15 year old from the household grid file, INDALL. Both files contain derived relationship pointers, e.g.;
https://www.understandingsociety.ac.uk/documentation/mainstage/dataset-documentation/wave/3/datafile/c_indall/variable/c_hgbiom
or the crosswave version of the same;
https://www.understandingsociety.ac.uk/documentation/mainstage/dataset-documentation/wave/3/datafile/c_indresp/variable/mpid
CHILD also holds substantive information collected on individual children.
EGOALT holds the pairwise relationships between household members.
The relationship pointers are based on EGOALT and are often a quicker way of creating this kind of datasets. Stata users would however have to rename, say, pidp to chpidp and mpid to pidp before merging in data on the mother from INDRESP.
Jakob
Updated by Jose Iparraguirre over 10 years ago
Thanks Jakob, but I still can't find my way around this.
I've renamed the variables and tried to merge the datasets but still get 0 matches.
Imagine all you need is to know the ages of the parents of the children in c_child.dta. Can you provide me with a piece of code in STATA to do this, please?
Thanks,
José
Updated by Jose Iparraguirre over 10 years ago
Guess I've got it. The key is to keep _merge==2, not _merge==3. Am I right?
Thanks,
José
Updated by Redmine Admin over 10 years ago
The following example combines mother's highest qualification (a_hiqual_dv) from the adult interview response file (A_INDRESP) with valid responses to a question about whether the responding parent would like the child to go on to university (a_kid2uni) from the child enumetation file (A_CHILD);
use pidp mpid a_kid2uni using a_child,clear
keep if a_kid2uni>0
ren pidp chpidp
ren mpid pidp
merge m:1 pidp using a_indresp,keep(3) nogen keepus(a_hiqual_dv)
ta a_hiqual_dv a_kid2uni,row
Jakob
Updated by Jose Iparraguirre over 10 years ago
Thanks Jacob. That's what I needed.
Kind regards,
José
Updated by Redmine Admin over 10 years ago
- Category set to Data analysis
- Status changed from New to Closed
- Target version set to X M
- % Done changed from 50 to 100
Updated by Jose Iparraguirre over 10 years ago
Sorry Jakob.
In fact, it's not what I need.
To begin with I'm working with Wave 3 and there variable c_kid2uni is not included in the c_child.dta
But that's not too important.
Let's simply merge the child and indresp datasets following your code:
use "F:\Personal\Data\Undestanding Society\Waves 1 - 3\stata12_se\c_child.dta",clear
ren pidp chpidp
ren mpid pidp
merge m:1 pidp using "F:\Personal\Data\Undestanding Society\Waves 1 - 3\stata12_se\c_indresp.dta",keep(3)
I get 14,402 matched observations.
Now, if I want to see let's say the ages of these respondents, I get:
. ta c_dvage
age | Freq. Percent Cum.
-------------+-----------------------------------
missing | 4 0.03 0.03
0 | 851 5.91 5.94
1 | 823 5.71 11.65
2 | 940 6.53 18.18
3 | 962 6.68 24.86
4 | 952 6.61 31.47
5 | 939 6.52 37.99
6 | 911 6.33 44.31
7 | 899 6.24 50.56
8 | 885 6.14 56.70
9 | 843 5.85 62.55
10 | 951 6.60 69.16
11 | 835 5.80 74.95
12 | 928 6.44 81.40
13 | 892 6.19 87.59
14 | 909 6.31 93.90
15 | 878 6.10 100.00
-------------+-----------------------------------
Total | 14,402 100.00
All I get out of the merger is the ages of children -not of their parents. In other words, after merging both datasets I don't know the ages of the parents of the children in c_child.dta (or nothing else about these parents).
So, let me rephrase my previous query:
How can I obtain in STATA the ages of the parents of the children in c_child.dta?
Many thanks,
José
Updated by Redmine Admin over 10 years ago
- Status changed from Closed to In Progress
- % Done changed from 100 to 60
Try..
use pidp mpid c_dvage using c_child,clear
ren c_dvage chage
ren pidp chpidp
ren mpid pidp
merge m:1 pidp using c_indresp,keep(3) nogen keepus(c_dvage)
ren c_dvage mage
gr hbox mage if mage>=0 & chage>=0,over(chage)
Jakob
Updated by Redmine Admin over 10 years ago
- Status changed from In Progress to Closed
- % Done changed from 60 to 100