⚲
Project
General
Profile
Sign in
Register
Home
Search
:
Understanding Society User Support
All Projects
Understanding Society User Support
Overview
Activity
Issues
Download (1.47 KB)
Support #1826
ยป Socioeconomic status.do
Understanding Society User Support Team
, 12/08/2022 09:47 PM
use
"*\i_youth.dta"
** Remove * and replace "filepath of your working directory"
** with the filepath where you want to save all files
** That is your working directory.
** Remember to include the double quotes
ren
pidp
pidp_y
**In this example natural father pidp is choosen
ren
i_fnpid
pidp
order
pidp_y
pidp
** Individual income estimates are included in the individual level data files, *_indresp.
merge
m
:
1
pidp
using
"\i_indresp.dta"
**For Covid-19 survey
use
"*\cf_youth_p.dta"
ren
pidp_c
pidp
**Parent identifiers**
merge
1
:
1
pidp
using
"*\h_indall.dta"
,
keepusing
(
h_fnpid
h_mnpid
h_pn1pid
h_pn2pid
h_pns1pid
h_pns2pid
h_fnspid
h_mnspid
)
**Drop using observations
drop
if
_merge
==
2
ren
_merge
h_merge
**Generate a variable to identify if all observations from cf_youth_p.dta match *_indall to have parent identifiers
gen
merge
=
3
if
h_merge
==
3
**Repeat the process for the rest of the waves
merge
1
:
1
pidp
using
"*\*_indall.dta"
,
keepusing
(
*
_fnpid
*
_mnpid
*
_pn1pid
*
_pn2pid
*
_pns1pid
*
_pns2pid
*
_fnspid
*
_mnspid
)
drop
if
_merge
==
2
ren
_merge
*
_merge
replace
merge
=
3
if
*
_merge
==
3
&
merge
==.
**In this example natural father pidp is choosen
**Repeat the process for the rest of the waves
gen
fnpid
=
h_fnpid
replace
fnpid
=
i_fnpid
if
fnpid
==.
replace
fnpid
=
*
_fnpid
if
fnpid
==.
ren
pidp
pidp_c
ren
fnpid
pidp
** Individual income estimates are included in the individual level data files, *_indresp.
merge
m
:
1
pidp
using
"\*_indresp.dta"
(1-1/1)
Loading...