Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Earnings Code for 5 merged NIDS waves

    Hello

    I am currently doing my research on intergenerational social mobility in South Africa. I have managed to merge the data but now I am trying to create earnings using the data. I am trying to eventually re-make the results in a paper by Patrizio titled Intergenerational Earnings Mobility and Equality of Opportunity in South Africa. I have been given this code without instruction on how to do it for each wave w1_ w2_ w3_ w4_ w5_ .


    Issue 1: I was told I would need to individually make the code for each wave. I've tried and the biggest question is which variables I would need to change for each wave. e.g. I know I would change variables like cwag to w1_cwag, next w2_cwag etc.

    Issue 2: I've looked for the variable "response" in the data and can't figure what the code means as it says not found. Does anyone who has worked with NIDS possibly know. I would really appreciate any type of help.

    * IMPUTATIONS FOR WAGE INCOME FOR NON-RESPONDERS


    ***Wage income for smooth
    egen wageincome1 = rowtotal(w1_fwag w1_cwag w1_swag w1_cheq w1_bonu)
    replace wageincome1 = . if response== 0
    gen lnwageincome1 = ln(wageincome1)

    *Wage income imputation stage 1 for smooth
    gen wageincome_d = wageincome!=0 if response==1
    replace wageincome_d = . if wageincome==.

    xi: probit wageincome_d yrschool i.r_edu male married age age_d agesq agecu i.hhprov i.race i.hometype i.homewalls i.homeroof homerooms
    predict wageincome_dhat

    *fwag_p income imputation stage 2 for smooth
    xi: regress lnwageincome yrschool i.postschool male married age age_d agesq agecu i.hhprov i.race i.hometype i.homewalls i.homeroof homerooms if wageincome>0
    predict lnwageincomehat
    gen wageincomehat = exp(lnwageincomehat)
    gen wageincomeEV = wageincomehat*wageincome_dhat

    gen wageincomeimpute = 1 if response==0 & wageincomeEV!=.
    replace wageincomeimpute = 0 if response==1 | wageincomeEV==.

    replace wageincome = wageincomeEV if wageincome==. & wageincomeEV!=. & response==0

    * now using impute command.
    xi: impute lnwageincome schooling i.postschool male married age age_d agesq i.hhprov i.race homerooms, gen(lnwageincomehat2)

    gen wageincomeimpute2 = 1 if response==0 & lnwageincomehat2!=.

    replace wageincome = exp(lnwageincomehat2) if wageincome==. & response==0

    *Imputation summary variable for smooth wage income
    gen wageincome_flg = 1 if wageincome!=.
    replace wageincome_flg = 2 if wageincomeimpute==1
    replace wageincome_flg = 3 if wageincome==.
    replace wageincome_flg = 4 if wageincomeimpute2==1
    label define wageincome_flg 1 "Survey*" 2 "Imputed" 3 "Missing" 4 "Imputed using `impute'"
    label values wageincome_flg wageincome_flg


    ************************************************** *******************************

    ***Allocating income to general categories

    ************************************************** *******************************

    *Total labour market income for smooth
    egen labourincome=rowtotal(wageincome help prof extr)
    gen lnlabourincome=ln(labourincome)
    label variable labourincome "Monthly income from all labour market sources"
Working...
X