clear _all set mem 200m set matsize 800 set more off capture log close set logtype text set trace off #delimit; global x: env PATH; global y: length global x; if $y==265{; global path D:; }; if $y~=265{; global path ~; set mem 300m; }; *log using $path/nta/cex/oldcex.log, replace; /*================================================ Program: cex1917.do Author: Avi Ebenstein Created: November 2005 Purpose: Age profile for income and consumption =================================================*/ use $path/nta/cex/cexdata/cex1917; **************************; * Censor odd values ; **************************; * There are no topcoded ; * values for 1917 ; **************************; *********************; * Husband / Wife Age ; *********************; rename v9 age1; rename v17 age2; ************; * Kids Age ; ************; rename v26 age3; rename v35 age4; rename v44 age5; rename v53 age6; rename v62 age7; rename v71 age8; rename v77 age9; rename v82 age10; rename v86 age11; rename v90 age12; rename v93 age13; *********; * Others ; *********; rename v99 age14; rename v109 age15; rename v119 age16; rename v126 age17; rename v136 age18; *********; * Income ; *********; rename v16 inc1; rename v24 inc2; rename v33 inc3; rename v42 inc4; rename v51 inc5; rename v60 inc6; rename v69 inc7; for num 8/13: capture gen incX=0; rename v106 inc14; rename v116 inc15; for num 16/18: capture gen incX=0; **************; * Consumption ; **************; rename v145 totearn; rename v146 food; rename v150 rent; rename v148 clothing; rename v152 homeval; rename v154 fuel; rename v156 furniture; rename v157 other; rename v158 misc; rename v159 totinc; rename v160 totexp; ******************; keep age* inc* food rent fuel clothing furniture other misc totinc totearn homeval totexp; gen newid=_n; *============================; * Create Individual Data Set ; *============================; reshape long age inc, i(newid) j(personid); drop if age==.; replace age=floor(age); *===========================; * Consmption Factor Weights ; *===========================; gen iweight=1-.60*(age>=5 & age<20)*[(20-age)/16]-.60*(age<=4); replace iweight=1.0 if age>=65; egen fweight=sum(iweight), by(newid); /*============================================ * * * Define the NTA variables * * * *===========================================*/ ******************************; * Labor income ; ******************************; rename inc yle; **************************************; * Non-labor income (Income - Earnings); **************************************; gen ky=0; replace ky=totinc-totearn if personid==1; *********************************; * Private Consumption, Education ; *********************************; gen cfe=0; ******************************; * Private Consumption, Health ; ******************************; gen cfh=0; ***************************; * PC Other 1, Expenditures ; ***************************; *gen cfx1=(food+rent+fuel+clothing+other+misc+totexp)*(iweight/fweight); gen cfx1=totexp*(iweight/fweight); ***************************; * PC Other 2, Own Housing ; ***************************; gen cfx2=(homeval)*(iweight/fweight); ***************************; * PC Other 3, Durables ; ***************************; gen cfx3=(furniture)*(iweight/fweight); **************************; * Censor Age Distribution ; **************************; replace age=89 if age>=90; *****************************; * Create 5-year age category ; *****************************; egen agecat=cut(age), at(0(5)90); **************; * Unlabel Age ; **************; label values age; **************************; * ; * 1917 AGE PROFILE DATA ; * ; **************************; gen mywgt=1; save $path/nta/cex/cexdata/cex1917_t.dta, replace; exit;