***************************************************************************************** * Stata program for the conversion of data from the India NSS57 survey * from ASCII format to Stata format. * This program converts data from Schedule 1.0 and adds variables and value labels. * * Author: Akiko Sagesaka, World Bank Data Group (Jun. 2013) ***************************************************************************************** clear set more off #delimit ; global pathin "L:\HHS\Datalib\India\IND_2001_NSS57-SCH1.0\IND_2001_NSS57-SCH1.0_v01_M\Data\Original"; global pathout "L:\HHS\Datalib\India\IND_2001_NSS57-SCH1.0\IND_2001_NSS57-SCH1.0_v01_M\Data\Stata"; tempfile tempR tempU; ***************************************************************; * SCHEDULE 1 - WORKFILE 1 ; ***************************************************************; local workfile R U; foreach i in `workfile' {; drop _all; infix str WID 1-2 str B1_v01 3-5 str B1_v03 6-6 str B1_v04 7-7 str B1_v05 8-10 str B1_v07 11-12 str B1_v08 13-14 str B1_v06 15-16 str B1_v09 17-17 str B1_v10 18-18 str B1_v11 19-23 str B1_v13 24-24 str B1_v14 25-26 str B1_v17 27-27 str B1_v18 28-28 str NSS 29-31 str NSC 32-34 str MLT 35-44 str B3_v01 45-46 str B3_v17 47-54 str B3_v17a 55-56 str B3_v17b 57-58 str B3_v04 59-59 str B3_v05 60-60 str B3_v06 61-61 str B3_v07 62-63 str B3_v08 64-64 str B3_v09 65-65 str B3_v10 66-66 str B3_v11 67-69 str B3_v12 70-71 str B3_v13 72-72 str B3_v14 73-73 str B3_v15 74-74 str B3_v16 75-75 str B10_v01 76-76 str B10_v02a 77-78 str B10_v02b 79-80 str B10_v02c 81-82 str B10_v02d 83-84 str B10_v02e 85-86 str B10_v02f 87-88 str B10_v02g 89-90 str B10_v02h 91-92 str B10_v02i 93-94 str B10_v02j 95-96 str B10_v02k 97-98 str B10_v02l 99-100 str B10_v02n 101-102 str B10_v03 103-103 str B2_v04 104-106 str B4_v01 107-109 str B4_v03 110-110 str B4_v04 111-111 str B4_v05 112-113 str B4_v06 114-114 str B4_v07 115-116 str B4_v08 117-118 str B4_v09 119-120 str B4_v10 121-122 str B4_v11 123-124 str B4_v12 125-126 str B4_v13 127-128 str B4_v14 129-130 str B4_v15 131-131 str B4_v16 132-133 str B4_v17 134-135 str B4_v18 136-137 str B4_v19 138-139 str B4_v20 140-141 using "$pathin\WHCC101`i'.DAT"; compress; save `temp`i'', replace; }; use `tempR', clear; append using `tempU'; gen hhid= B1_v10+B1_v11+B1_v13+B1_v14; gen state=substr(B1_v05,1,2); destring *, replace; order hhid state *; gen hhwt=MLT/100 if NSC==NSS; replace hhwt=MLT/200 if NSC > NSS; format hhid %15.0g; label variable hhid "Household ID"; label variable state "State"; label variable WID "Workfile ID"; label variable B1_v01 "Round Schedule"; label variable B1_v03 "SS-Original"; label variable B1_v04 "Sector"; label variable B1_v05 "State – Reg."; label variable B1_v07 "Stratum"; label variable B1_v08 "Sub-Stratum"; label variable B1_v06 "District"; label variable B1_v09 "Sub-Round"; label variable B1_v10 "SS-Posted"; label variable B1_v11 "FSU"; label variable B1_v13 "Segment"; label variable B1_v14 "HHD"; label variable B1_v17 "Survey Code"; label variable B1_v18 "Reason-Substitution"; label variable NSS "NSS"; label variable NSC "NSC"; label variable MLT "Mult-SS"; label variable B3_v01 "House-hold Size"; label variable B3_v17 "MPCE"; label variable B3_v17a "MPCE Code"; label variable B3_v17b "CMPCE-Code"; label variable B3_v04 "House-hold Type"; label variable B3_v05 "Religion"; label variable B3_v06 "Social Group"; label variable B3_v07 "Lp Code"; label variable B3_v08 "Dwelling Code"; label variable B3_v09 "Type Dwelling"; label variable B3_v10 "Type Structure"; label variable B3_v11 "Covered Area"; label variable B3_v12 "Cook"; label variable B3_v13 "Light"; label variable B3_v14 "Meal Taken Outside"; label variable B3_v15 "Ceremony Performed"; label variable B3_v16 "PDS Purchase"; label variable B10_v01 "Get Food"; label variable B10_v02a "Not Get Food in the Month of January"; label variable B10_v02b "Not Get Food in the Month of February"; label variable B10_v02c "Not Get Food in the Month of March"; label variable B10_v02d "Not Get Food in the Month of April"; label variable B10_v02e "Not Get Food in the Month of May"; label variable B10_v02f "Not Get Food in the Month of June"; label variable B10_v02g "Not Get Food in the Month of July"; label variable B10_v02h "Not Get Food in the Month of August"; label variable B10_v02i "Not Get Food in the Month of Sept."; label variable B10_v02j "Not Get Food in the Month of October"; label variable B10_v02k "Not Get Food in the Month of Nov."; label variable B10_v02l "Not Get Food in the Month of December"; label variable B10_v02n "Total No. Of Month Not Getting Food"; label variable B10_v03 "Whether Asked"; label variable B2_v04 "Time Canvass"; label variable B4_v01 "Person Serial No."; label variable B4_v03 "Relation"; label variable B4_v04 "Sex"; label variable B4_v05 "Age"; label variable B4_v06 "Marital Status"; label variable B4_v07 "Education Code"; label variable B4_v08 "UPST Code"; label variable B4_v09 "UPNIC Code"; label variable B4_v10 "SBST Code"; label variable B4_v11 "SBNIC Code"; label variable B4_v12 "CWST Code"; label variable B4_v13 "CWNIC Code"; label variable B4_v14 "Days Stayed Away"; label variable B4_v15 "No. Of Meal Per Day"; label variable B4_v16 "Meal At School"; label variable B4_v17 "Meal From Employer"; label variable B4_v18 "Meal From Other Sources"; label variable B4_v19 "Meal On Payment"; label variable B4_v20 "Meal At Home"; label variable hhwt "Household Weight"; label define state 1 "Jammu & Kashmir" 2 "Himachal Pradesh" 3 "Punjab" 4 "Chandigarh" 5 "Uttaranchal" 6 "Haryana" 7 "Delhi" 8 "Rajasthan" 9 "Uttar Pradesh" 10 "Bihar" 11 "Sikkim" 12 "Arunachal Pradesh" 13 "Nagaland" 14 "Manipur" 15 "Mizoram" 16 "Tripura" 17 "Meghalaya" 18 "Assam" 19 "West Bengal" 20 "Jharkhand" 21 "Orissa" 22 "Chattisgarh" 23 "Madhya Pradesh" 24 "Gujarat" 25 "Daman & Diu" 26 "Dadra & Nagar Haveli" 27 "Maharastra" 28 "Andhra Pradesh" 29 "Karnataka" 30 "Goa" 31 "Lakshadweep" 32 "Kerala" 33 "Tamil Nadu" 34 "Pondicherry" 35 "A & N Islands"; label define sample 1 "Central" 2 "State"; label define sector 1 "Rural" 2 "Urban"; label define RespCode 1 "Informant co-operative and capable" 2 "Informant co-operative but not capable" 3 "Informant busy" 4 "Informant reluctant" 9 "Others"; label define SurvCode 1 "Original" 2 "Substitute" 3 "Casualty"; label define subst 1 "Informant busy" 2 "Members away from home" 3 "Informant non-cooperative" 9 "Others"; label values state state; label values B1_v03 sample; label values B1_v04 sector; label values B1_v17 SurvCode; label values B1_v18 subst; preserve; drop B4_v01 B4_v03 B4_v04 B4_v05 B4_v06 B4_v07 B4_v08 B4_v09 B4_v10 B4_v11 B4_v12 B4_v13 B4_v14 B4_v15 B4_v16 B4_v17 B4_v18 B4_v19 B4_v20; bys hhid: gen ind=_n; keep if ind==1; drop ind; sort hhid; save "$pathout\NSS57_Sch1_bk_1_2_3_10", replace; restore; keep hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B4_v01 B4_v03 B4_v04 B4_v05 B4_v06 B4_v07 B4_v08 B4_v09 B4_v10 B4_v11 B4_v12 B4_v13 B4_v14 B4_v15 B4_v16 B4_v17 B4_v18 B4_v19 B4_v20 hhwt; sort hhid B4_v01; save "$pathout\NSS57_Sch1_bk_4", replace; ***************************************************************; * SCHEDULE 1 - WORKFILE 2 ; ***************************************************************; local workfile R U; foreach i in `workfile' {; drop _all; infix str WID 1-2 str B1_v01 3-5 str B1_v03 6 str B1_v04 7 str B1_v05 8-10 str B1_v07 11-12 str B1_v08 13-14 str B1_v06 15-16 str B1_v09 17 str B1_v10 18 str B1_v11 19-23 str B1_v13 24 str B1_v14 25-26 str B1_v17 27 str B1_v18 28 str NSS 29-31 str NSC 32-34 str MLT 35-44 str B3_v01 45-46 str B3_v17 47-54 str B3_v17a 55-56 str B3_v17b 57-58 str B3_v04 59 str B3_v05 60 str B3_v06 61 str B3_v07 62-63 str B3_v08 64 str B3_v09 65 str B3_v10 66 str B3_v11 67-69 str B3_v12 70-71 str B3_v13 72 str B3_v14 73 str B3_v15 74 str B3_v16 75 str B2_v04 76-78 str B5_v01 79-81 str B9_v06 82-89 str B5_v03 90-97 str B5_v04 98-105 str B5_v05 106 str B9_v03 107-109 using "$pathin\WHCC102`i'.DAT"; compress; save `temp`i'', replace; }; use `tempR', clear; append using `tempU'; gen hhid= B1_v10+B1_v11+B1_v13+B1_v14; gen state=substr(B1_v05,1,2); destring *, replace; order hhid state *; gen hhwt=MLT/100 if NSC==NSS; replace hhwt=MLT/200 if NSC > NSS; format hhid %15.0g; label variable hhid "Household ID"; label variable state "State"; label variable WID "Workfile ID"; label variable B1_v01 "Round Schedule"; label variable B1_v03 "SS-Original"; label variable B1_v04 "Sector"; label variable B1_v05 "State-Region"; label variable B1_v07 "Stratum"; label variable B1_v08 "Sub-Stratum"; label variable B1_v06 "District"; label variable B1_v09 "Sub-Round"; label variable B1_v10 "SS-Posted"; label variable B1_v11 "FSU"; label variable B1_v13 "Segment"; label variable B1_v14 "House-hold"; label variable B1_v17 "Survey-Code"; label variable B1_v18 "Reason-Substitution"; label variable NSS "NSS"; label variable NSC "NSC"; label variable MLT "Mult-SS"; label variable B3_v01 "House-hold Size"; label variable B3_v17 "MPCE"; label variable B3_v17a "MPCE Code"; label variable B3_v17b "CMPCE Code"; label variable B3_v04 "House-hold Type"; label variable B3_v05 "Religion"; label variable B3_v06 "Social Group"; label variable B3_v07 "LP Code"; label variable B3_v08 "Dwelling Code"; label variable B3_v09 "Type Dwelling"; label variable B3_v10 "Type Structure"; label variable B3_v11 "Covered Area"; label variable B3_v12 "Cook"; label variable B3_v13 "Light"; label variable B3_v14 "Meal Taken Outside"; label variable B3_v15 "Ceremony Performed"; label variable B3_v16 "PDS Purchase"; label variable B2_v04 "Time Canvass"; label variable hhwt "Household Weight"; label define state 1 "Jammu & Kashmir" 2 "Himachal Pradesh" 3 "Punjab" 4 "Chandigarh" 5 "Uttaranchal" 6 "Haryana" 7 "Delhi" 8 "Rajasthan" 9 "Uttar Pradesh" 10 "Bihar" 11 "Sikkim" 12 "Arunachal Pradesh" 13 "Nagaland" 14 "Manipur" 15 "Mizoram" 16 "Tripura" 17 "Meghalaya" 18 "Assam" 19 "West Bengal" 20 "Jharkhand" 21 "Orissa" 22 "Chattisgarh" 23 "Madhya Pradesh" 24 "Gujarat" 25 "Daman & Diu" 26 "Dadra & Nagar Haveli" 27 "Maharastra" 28 "Andhra Pradesh" 29 "Karnataka" 30 "Goa" 31 "Lakshadweep" 32 "Kerala" 33 "Tamil Nadu" 34 "Pondicherry" 35 "A & N Islands"; label define sample 1 "Central" 2 "State"; label define sector 1 "Rural" 2 "Urban"; label define RespCode 1 "Informant co-operative and capable" 2 "Informant co-operative but not capable" 3 "Informant busy" 4 "Informant reluctant" 9 "Others"; label define SurvCode 1 "Original" 2 "Substitute" 3 "Casualty"; label define subst 1 "Informant busy" 2 "Members away from home" 3 "Informant non-cooperative" 9 "Others"; label values state state; label values B1_v03 sample; label values B1_v04 sector; label values B1_v17 SurvCode; label values B1_v18 subst; sort hhid B5_v01; save "$pathout\NSS57_Sch1_bk_CONS", replace; keep if inrange(B5_v01,101,359); label variable B5_v01 "Item Code"; label variable B5_v03 "Quantity"; label variable B5_v04 "Value"; label variable B5_v05 "Food Code"; label define src 1 "only purchase" 2 "only home-grown stock" 3 "both purchase and home-grown stock" 4 "only free collection" 9 "others"; label values B5_v05 src; keep hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B5_v01 B5_v03 B5_v04 B5_v05 hhwt; order hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B5_v01 B5_v03 B5_v04 B5_v05 hhwt; save "$pathout\NSS57_Sch1_bk_5_5-1", replace; use "$pathout\NSS57_Sch1_bk_CONS", clear; keep if inrange(B5_v01,360,399); rename B5_v01 B6_v01; rename B5_v03 B6_v03; rename B5_v04 B6_v04; label variable B6_v01 "Item Code"; label variable B6_v03 "Quantity"; label variable B6_v04 "Value"; keep hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B6_v01 B6_v03 B6_v04 hhwt; order hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B6_v01 B6_v03 B6_v04 hhwt; save "$pathout\NSS57_Sch1_bk_6_7", replace; use "$pathout\NSS57_Sch1_bk_CONS", clear; keep if inrange(B5_v01,400,549); rename B5_v01 B8_v01; rename B5_v04 B8_v03; label variable B8_v01 "Item Code"; label variable B8_v03 "Value"; keep hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B8_v01 B8_v03 hhwt; order hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B8_v01 B8_v03 hhwt; save "$pathout\NSS57_Sch1_bk_8", replace; use "$pathout\NSS57_Sch1_bk_CONS", clear; keep if inrange(B5_v01,550,659); rename B5_v01 B9_v01; rename B5_v03 B9_v09; rename B5_v04 B9_v10; label variable B9_v01 "Item Code"; label variable B9_v03 "On Use Of Durable"; label variable B9_v06 "First Hand Value"; label variable B9_v09 "Second Hand Value"; label variable B9_v10 "Total Value"; keep hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B9_v01 B9_v03 B9_v06 B9_v09 B9_v10 hhwt; order hhid state WID B1_v01 B1_v03 B1_v04 B1_v05 B1_v07 B1_v08 B1_v06 B1_v09 B1_v10 B1_v11 B1_v13 B1_v14 B1_v17 B1_v18 NSS NSC MLT B3_v01 B3_v17 B3_v17a B3_v17b B3_v04 B3_v05 B3_v06 B3_v07 B3_v08 B3_v09 B3_v10 B3_v11 B3_v12 B3_v13 B3_v14 B3_v15 B3_v16 B2_v04 B9_v01 B9_v03 B9_v06 B9_v09 B9_v10 hhwt; save "$pathout\NSS57_Sch1_bk_9", replace; erase "$pathout\NSS57_Sch1_bk_CONS";