/* This do-file picks better hours and earnings data from the family files and merges them to the cross-year individual file. In order to run this on your computer, you should change the path in the third line of the code to your working directory, which should contain the cross-year individual file, and the family files for waves 3,4,8-13. The resulting data set will contain the cross-year individual file with the household head's wage income, inc_YR for years YR=74-79, and variables hrs_69 and hrs_70 with more reliable data on hours worked by the household head for the 3rd and 4th wave. You'd still have to select whichever other data you are planning to use, select your working sample, and put the data into a format that you can use for your analysis.*/ clear set mem 200m cd c:\data\661_ps1\ set more off log using merge_psid, replace /* Get better hours and earnings data from files for wave 3 and 4*/ use 07439-0004-Data, clear keep if V1240==1&V1239>=21&V1239<=64 ren V1138 hrs_69 ren V1102 int_69 sort int_69 keep *_69 save 661wave3, replace use 07439-0005-Data, clear keep if V1943==1&V1942>=21&V1942<=64 ren V1839 hrs_70 ren V1802 int_70 sort int_70 keep *_70 save 661wave4, replace /* Get better earnings data from files for later waves 8-13*/ use 07439-0009-Data, clear ren V3858 inc_74 ren V3802 int_74 sort int_74 keep *_74 save 661wave8, replace use 07439-0010-Data, clear ren V4373 inc_75 ren V4302 int_75 sort int_75 keep *_75 save 661wave9, replace use 07439-0011-Data, clear ren V5283 inc_76 ren V5202 int_76 sort int_76 keep *_76 save 661wave10, replace use 07439-0012-Data, clear ren V5782 inc_77 ren V5702 int_77 sort int_77 keep *_77 save 661wave11, replace use 07439-0013-Data, clear ren V6391 inc_78 ren V6302 int_78 sort int_78 keep *_78 save 661wave12, replace use 07439-0014-Data, clear ren V6981 inc_79 ren V6902 int_79 sort int_79 keep *_79 save 661wave13, replace /*1969(W3)-1979(W12)*/ use 07439-0001-Data, clear ren V30043 int_69 ren V30067 int_70 ren V30160 int_74 ren V30188 int_75 ren V30217 int_76 ren V30246 int_77 ren V30283 int_78 ren V30313 int_79 sort int_69 merge int_69 using 661wave3 tab _merge drop if _merge<3 drop _merge sort int_70 merge int_70 using 661wave4 tab _merge drop if _merge<3 drop _merge loc w=8 forvalues i=74/79{ sort int_`i' merge int_`i' using 661wave`w' tab _merge drop if _merge<3 drop _merge loc ++w } !del 661wave*.dta log close