https://iserredex.essex.ac.uk/support/https://iserredex.essex.ac.uk/support/support/favicon.ico?15995719382017-01-11T11:43:53ZUnderstanding Society User SupportUnderstanding Society User Support - Support #692: merging _indresp and _child across all waves https://iserredex.essex.ac.uk/support/issues/692?journal_id=23422017-01-11T11:43:53ZAlita Nandi
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li><li><strong>Assignee</strong> changed from <i>Alita Nandi</i> to <i>Nico Ochmann</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>90</i></li></ul><p>Dear Nico,</p>
<p>The pidp in w_child file is the pidp of the child (< 16 year olds). The pidp in w_indresp is the pidp of the adult respondents (16+ year olds). So, if you merge these two files on pidp they will never match. What you need to do is identify the PIDP of the parents of the children in w_child: w_fnspid w_mnspid in w_indall. Then rename these variables to PIDP and then merge that with w_indresp using PIDP. Note you will have to do this separately for the father and mother.</p>
<p>Best wishes,<br />Alita</p> Understanding Society User Support - Support #692: merging _indresp and _child across all waves https://iserredex.essex.ac.uk/support/issues/692?journal_id=23432017-01-11T11:44:10ZAlita Nandi
<ul><li><strong>Private</strong> changed from <i>Yes</i> to <i>No</i></li></ul> Understanding Society User Support - Support #692: merging _indresp and _child across all waves https://iserredex.essex.ac.uk/support/issues/692?journal_id=23462017-01-11T20:27:12ZNico Ochmannnico.ochmann@postgrad.manchester.ac.uk
<ul></ul><p>Thank you very much once again!</p>
<p>Just as a note, it seems to me that I need to merge these two files using PIDP and wave.</p>
<p>Cheers!</p>
<p>Nico</p> Understanding Society User Support - Support #692: merging _indresp and _child across all waves https://iserredex.essex.ac.uk/support/issues/692?journal_id=23612017-01-16T10:46:55ZAlita Nandi
<ul></ul><p>You can either<br />(i) do the merge exercise separately for each wave, save the final file as a wave specific file and then append them, or<br />(ii) produce a long file for each type of file and then merge them together - using pidp and wave</p> Understanding Society User Support - Support #692: merging _indresp and _child across all waves https://iserredex.essex.ac.uk/support/issues/692?journal_id=23862017-01-23T13:00:07ZNico Ochmannnico.ochmann@postgrad.manchester.ac.uk
<ul></ul><p>Dear Dr Nandi,</p>
<p>I do have a short follow up question before you close this one. In the cild file I have 90,000 obs. I end up with only 60,000 matches when I merge the files. <br />I cannot see why I would have such a large number of mismatches. If you have any ideas, I would appreciate a short comment. <br />Thanks a lot!</p>
<p>Nico </p>
<pre><code>Result # of obs.<br /> -----------------------------------------<br /> not matched 289,433<br /> from master 259,370 (_wemerge==1)<br /> from using 30,063 (_wemerge==2)</code></pre>
<pre><code>matched 60,664 (_wemerge==3)<br /> -----------------------------------------</code></pre>
<p>global Stata11_se "F:\UnderstandingSocietyData\Data\stata\stata11_se" <br />global data "P:\Mergeddata_master2016_religion" <br />global dofiles "P:\Dofiles_master2016_religion" <br />global logfiles "P:\Logfiles_master2016_religion"</p>
<hr />
<p>foreach w in a b c d e f{</p>
<pre><code>use `w'_ukborn pidp fpid mpid `w'_hidp `w'_pno `w'_istrtdaty `w'_plbornc `w'_jbhrs `w'_qfhigh `w'_qualoc `w'_sex `w'_dvage `w'_marstat `w'_fimngrs_dv `w'_fimnlabgrs_dv `w'_jbstat `w'_plbornc_all `w'_pacob_all `w'_macob_all ///<br /> `w'_oprlg1 `w'_oprlg0 /// <br /> `w'_paygu_dv `w'_oprlg `w'_yr2uk4 `w'_birthy `w'_feend `w'_scend `w'_jbterm1 `w'_jbsize `w'_jbsect `w'_jbsectpub `w'_racel `w'_jbbgy `w'_sf1 `w'_jbmngr `w'_lnprnt `w'_jbsemp /// <br /> `w'_gor_dv `w'_urban_dv `w'_jshrs ///<br /> using "$Stata11_se/`w'_indresp_protect", clear</code></pre>
<pre><code>gen wave = strpos("abcdef","`w'")</code></pre>
<pre><code>renpfix `w'_</code></pre>
<pre><code>save $data/`w'wave, replace<br /> }<br />foreach w in a b c d e {</code></pre>
<pre><code>append using $data/`w'wave.dta<br /> }<br />sort wave pidp <br />rename pidp PIDP <br />rename dvage age <br />save $data/abcdef_long, replace</code></pre>
<p>foreach w in a b c d e f{<br /> erase $data/`w'wave.dta<br />}</p>
<p>foreach w in a b c d e f{</p>
<pre><code>use pidp `w'_hidp `w'_sex `w'_dvage `w'_hgbiom `w'_hgbiof `w'_adresp15 `w'_birthy `w'_birthm fpid mpid `w'_fnpno `w'_fnspid `w'_mnpno `w'_mnspid /// <br /> using "$Stata11_se/`w'_child_protect", clear</code></pre>
<pre><code>gen wave = strpos("abcdef","`w'")</code></pre>
<pre><code>renpfix `w'_</code></pre>
<pre><code>save $data/`w'wave, replace<br /> }<br />foreach w in a b c d e {</code></pre>
<pre><code>append using $data/`w'wave.dta<br /> }<br />sort wave pidp <br />rename fnspid PIDP<br />rename dvage childage <br />rename sex childgender <br />save $data/abcdef_long_2, replace</code></pre>
<p>foreach w in a b c d e f{<br /> erase $data/`w'wave.dta<br />}</p>
<p>use $data/abcdef_long, clear</p>
<p>merge 1:m PIDP wave using $data/abcdef_long_2, generate (_wemerge)</p> Understanding Society User Support - Support #692: merging _indresp and _child across all waves https://iserredex.essex.ac.uk/support/issues/692?journal_id=24122017-01-30T18:38:40ZAlita Nandi
<ul></ul><p>A quick look at your syntax suggests that you have only matched with fathers and so are missing all children living in households without fathers.</p>
<p>Best wishes,<br />Alita</p> Understanding Society User Support - Support #692: merging _indresp and _child across all waves https://iserredex.essex.ac.uk/support/issues/692?journal_id=24532017-02-13T15:32:30ZVictoria Nolanvlnolan@essex.ac.uk
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>90</i> to <i>100</i></li></ul>