libname zh '~/taiwan/fies/sasdata'; options ls=72; %macro one(q); data zh.data&q; set zh.new&q; * import the SAS data; keep hhid weight areacode urban serial agrtype agr_area agr_work id1-id8 totinc1-totinc8 hirepay1-hirepay8 pay1_1-pay1_8 pay2_1-pay2_8 retpay1-retpay8 othpart1-othpart8 pay3_1-pay3_8 overtim1-overtim8 awards1-awards8 empins1-empins8 einsnhi1-einsnhi8 fringe1-fringe8 owninc1-owninc8 agrinc1-agrinc8 treeinc1-treeinc8 fishinc1-fishinc8 businc1-businc8 execinc1-execinc8 propinc1-propinc8 intinc1-intinc8 invinc1-invinc8 othprop1-othprop8 estrent1-estrent8 regtran1-regtran8 pritran1-pritran8 govtran1-govtran8 lowtran1-lowtran8 oldtran1-oldtran8 frmtran1-frmtran8 govgei1-govgei8 govnhi1-govnhi8 othtrng1-othtrng8 benins1-benins8 bengei1-bengei8 bennhi1-bennhi8 bustran1-bustran8 lifeben1-lifeben8 othtran1-othtran8 abrtran1-abrtran8 miscinc1-miscinc8 totexp1-totexp8 intexp1-intexp8 hosloan1-hosloan8 othloan1-othloan8 regtpay1-regtpay8 pritpay1-pritpay8 pritmar1-pritmar8 pritchr1-pritchr8 pritoth1-pritoth8 govtpay1-govtpay8 proptax1-proptax8 inctax1-inctax8 othtax1-othtax8 othpayg1-othpayg8 buspay1-buspay8 pgeiins1-pgeiins8 pliins1-pliins8 farmins1-farmins8 fishins1-fishins8 psiins1-psiins8 pnhiins1-pnhiins8 abrpay1-abrpay8; data zh.earner&q; set zh.data&q; keep hhid weight areacode urban serial agrtype agr_area agr_work personid totinc hirepay pay1 pay2 retpay othpart pay3 overtim awards empins einsnhi fringe owninc agrinc treeinc fishinc businc execinc propinc intinc invinc othprop estrent regtran pritran govtran lowtran oldtran frmtran govgei govnhi othtrng benins bengei bennhi bustran lifeben othtran abrtran miscinc totexp intexp hosloan othloan regtpay pritpay pritmar pritchr pritoth govtpay proptax inctax othtax othpayg socins pgeiins pliins farmins fishins psiins pnhiins abrpay; array ids{8} id1-id8; array tot{8} totinc1-totinc8; array hir{8} hirepay1-hirepay8; array pay1_s{8} pay1_1-pay1_8; array pay2_s{8} pay2_1-pay2_8; array retp{8} retpay1-retpay8; array othprt{8} othpart1-othpart8; array pay3_s{8} pay3_1-pay3_8; array overt{8} overtim1-overtim8; array awrds{8} awards1-awards8; array empin{8} empins1-empins8; array einsnh{8} einsnhi1-einsnhi8; array frng{8} fringe1-fringe8; array ownin{8} owninc1-owninc8; array agrin{8} agrinc1-agrinc8; array treein{8} treeinc1-treeinc8; array fishin{8} fishinc1-fishinc8; array busin{8} businc1-businc8; array execin{8} execinc1-execinc8; array propin{8} propinc1-propinc8; array intin{8} intinc1-intinc8; array invin{8} invinc1-invinc8; array othprp{8} othprop1-othprop8; array estrnt{8} estrent1-estrent8; array regtrn{8} regtran1-regtran8; array pritrn{8} pritran1-pritran8; array govtrn{8} govtran1-govtran8; array lowtrn{8} lowtran1-lowtran8; array oldtrn{8} oldtran1-oldtran8; array frmtrn{8} frmtran1-frmtran8; array govge{8} govgei1-govgei8; array govnh{8} govnhi1-govnhi8; array othtrg{8} othtrng1-othtrng8; array benin{8} benins1-benins8; array benge{8} bengei1-bengei8; array bennh{8} bennhi1-bennhi8; array bustrn{8} bustran1-bustran8; array lifebn{8} lifeben1-lifeben8; array othtrn{8} othtran1-othtran8; array abrtrn{8} abrtran1-abrtran8; array miscin{8} miscinc1-miscinc8; array totex{8} totexp1-totexp8; array intex{8} intexp1-intexp8; array hosln{8} hosloan1-hosloan8; array othln{8} othloan1-othloan8; array regtp{8} regtpay1-regtpay8; array pritp{8} pritpay1-pritpay8; array pritmr{8} pritmar1-pritmar8; array pritcr{8} pritchr1-pritchr8; array pritot{8} pritoth1-pritoth8; array govtp{8} govtpay1-govtpay8; array proptx{8} proptax1-proptax8; array inctx{8} inctax1-inctax8; array othtx{8} othtax1-othtax8; array othpg{8} othpayg1-othpayg8; array busp{8} buspay1-buspay8; array pgeiin{8} pgeiins1-pgeiins8; array pliin{8} pliins1-pliins8; array farmin{8} farmins1-farmins8; array fishns{8} fishins1-fishins8; array psiin{8} psiins1-psiins8; array pnhiin{8} pnhiins1-pnhiins8; array abrp{8} abrpay1-abrpay8; do j=1 to 8; if (ids{j} ne . and ids{j} ne 0) then do; personid = ids{j}; totinc = tot{j}; hirepay = hir{j}; pay1 = pay1_s{j}; pay2 = pay2_s{j}; retpay = retp{j}; othpart = othprt{j}; pay3 = pay3_s{j}; overtim = overt{j}; awards = awrds{j}; empins = empin{j}; einsnhi = einsnh{j}; fringe = frng{j}; owninc = ownin{j}; agrinc = agrin{j}; treeinc = treein{j}; fishinc = fishin{j}; businc = busin{j}; execinc = execin{j}; propinc = propin{j}; intinc = intin{j}; invinc = invin{j}; othprop = othprp{j}; estrent = estrnt{j}; regtran = regtrn{j}; pritran = pritrn{j}; govtran = govtrn{j}; lowtran = lowtrn{j}; oldtran = oldtrn{j}; frmtran = frmtrn{j}; govgei = govge{j}; govnhi = govnh{j}; othtrng = othtrg{j}; benins = benin{j}; bengei = benge{j}; bennhi = bennh{j}; bustran = bustrn{j}; lifeben = lifebn{j}; othtran = othtrn{j}; abrtran = abrtrn{j}; miscinc = miscin{j}; totexp = totex{j}; intexp = intex{j}; hosloan = hosln{j}; othloan = othln{j}; regtpay = regtp{j}; pritpay = pritp{j}; pritmar = pritmr{j}; pritchr = pritcr{j}; pritoth = pritot{j}; govtpay = govtp{j}; proptax = proptx{j}; inctax = inctx{j}; othtax = othtx{j}; othpayg = othpg{j}; socins = busp{j}; pgeiins = pgeiin{j}; pliins = pliin{j}; farmins = farmin{j}; fishins = fishns{j}; psiins = psiin{j}; pnhiins = pnhiin{j}; abrpay = abrp{j}; output; end; end; label hhid ='Sample household id' personid ='Internal hhid' weight ='Sample weight' areacode ='Area Code' urban ='Urbanization' serial ='Serial number of households' agrtype = "Farm/nonfarm household" agr_area = "Farm hhold class by cult land size" agr_work = "Farm hhold class by working hours" personid = "Code of member in the hhold" totinc = "Total Receipt" hirepay = "Compensation of employees" pay1 = "Full time pay-roll" pay2 = "Part time and spare time pay-roll" retpay = "Retirement pay" othpart = "Other part time payroll" pay3 = "Other receipts or subsidies" overtim = "Overtime pay" awards = "Awards" empins = "Ins of GEI, LI, FHI, & SI by employers" einsnhi = "Insurance of NHI by employers" fringe = "Fringe and death benefits" owninc = "Enterpreneurial income" agrinc = "Agricultural & livestock income" treeinc = "Net forest income" fishinc = "Net fishing income" businc = "Net operation surplus" execinc = "Net professional income" propinc = "Net property income" intinc = "Interest income" invinc = "Investment income" othprop = "Others - property income" estrent = "Imputed rent income" regtran = "Current transfer receipts" pritran = "Transfers from individuals" govtran = "Transfers from govt." lowtran = "Tr from govt - low inc hholds" oldtran = "Tr from govt - old-age allowance" frmtran = "Tr from govt - old farmer annuity" govgei = "Ins of GEI, LI, FHI, & SI by govt" govnhi = "Insurance of NHI by government" othtrng = "Tr from govt others" benins = "Benefits of social insurance" bengei = "Benefit of GEI, LI, FHI, and SI" bennhi = "Benefit of NHI" bustran = "Transfers from enterprises" lifeben = "Cash benefit of life of life & casualty ins" othtran = "Other transfers from enterprises" abrtran = "Transfers from abroad" miscinc = "Miscellaneous receipts" totexp = "Total nonconsumption expenditure" intexp = "Interest expenditure" hosloan = "Interest - house loans" othloan = "Interest - others" regtpay = "Current transfers expenditures" pritpay = "Transfers to individuals" pritmar = "Priv tr exp - mar birth & funeral" pritchr = "Priv tr exp - charities" pritoth = "Priv tr exp - others" govtpay = "Transfers to government" proptax = "House tax & land tax" inctax = "Income tax" othtax = "Other direct tax" othpayg = "Other transfers to govt." socins = "Social insurance" pgeiins = "Expenditure on GEI" pliins = "Expenditure on LI" farmins = "Expenditure on farmer's health insurance" fishins = "Expenditure on fisherman's health insurance" psiins = "Expenditure on SI" pnhiins = "Expenditure on NHI" abrpay = "Tranfers to abroad"; proc contents; run; %mend; %one(99); %one(00); %one(01); %one(02); %one(03); %include '~/nta/savastata.mac'; %macro convert(aa); data earner&aa; set zh.earner&aa; %savastata(~/taiwan/fies/fiesdata/,replace); run; %mend; %convert(99); %convert(00); %convert(01); %convert(02); %convert(03);