***************************************************************************************** * Stata program for the conversion of data from the India 2005 Economic Census * from ASCII format to Stata format. * This program converts data and adds variables and value labels. * * Author: Akiko Sagesaka, World Bank Data Group (Jul. 2013) ***************************************************************************************** clear set more off #delimit ; global pathin "C:\HHS\Datalib\India\IND_2005_EC\IND_2005_EC_v01_M\Data\Original"; global pathout "C:\HHS\Datalib\India\IND_2005_EC\IND_2005_EC_v01_M\Data\Stata"; tempfile tempR tempU; forvalues i=1/9 {; drop _all; infix str ES0a 1-2 str ES0b 3-3 str ES1 4-5 str ES2 6-7 str ES13 8-11 str ES14 12-19 str ES15 20-23 str ES0c 24-25 str A1 26-28 str A2 29-29 str A3 30-31 str A4 32-32 str A5 33-36 str A6 37-37 str A7 38-38 str A8 39-39 str A9 40-40 str A10 41-41 str A11a 42-42 str A11b 43-43 str A12 44-48 str A13 49-51 str A14 52-53 str A15 54-55 str A16 56-60 str A17 61-62 str A18 63-64 str A19 65-66 str A20 67-68 str A21 69-71 str A22 72-72 str A23 73-73 using "$pathin\ec05d0`i'c.txt"; keep if ES0b=="1"; compress; save `tempR', replace; drop _all; infix str ES0a 1-2 str ES0b 3-3 str ES1 4-5 str ES2 6-7 str ES23 8-9 str ES24 10-11 str ES25 12-16 str ES26 17-21 str ES27 22-23 str ES0c 24-25 str A1 26-28 str A2 29-29 str A3 30-31 str A4 32-32 str A5 33-36 str A6 37-37 str A7 38-38 str A8 39-39 str A9 40-40 str A10 41-41 str A11a 42-42 str A11b 43-43 str A12 44-48 str A13 49-51 str A14 52-53 str A15 54-55 str A16 56-60 str A17 61-62 str A18 63-64 str A19 65-66 str A20 67-68 str A21 69-71 str A22 72-72 str A23 73-73 using "$pathin\ec05d0`i'c.txt"; keep if ES0b=="2"; compress; save `tempU', replace; use `tempR', clear; append using `tempU'; destring *, replace; label variable ES0a "Schedule No."; label variable ES0b "Sector"; label variable ES1 "State-UT"; label variable ES2 "District"; label variable ES13 "Tehsil/Taluk/PS/Dev.Block/Circle/Panchayat etc."; label variable ES14 "Village"; label variable ES15 "Enumeration Block No."; label variable ES23 "Town"; label variable ES24 "Frame"; label variable ES25 "Ward No."; label variable ES26 "Investigator Unit No."; label variable ES27 "UFS Block No."; label variable ES0c "Page Number"; label variable A1 "Line No."; label variable A2 "Enterprise Premises Status Code No."; label variable A3 "Running Serial No of Enterprise within a page"; label variable A4 "Activity code (Major or Subsidiary)"; label variable A5 "Major activity NIC – 2004"; label variable A6 "Classification code (Agri or Non Agri)"; label variable A7 "Operation Code (Perennial or Not)"; label variable A8 "Ownership"; label variable A9 "Social Group of owner"; label variable A10 "Power/Fuel used for Enterprise activity"; label variable A11a "Registration Code (1st code)"; label variable A11b "Registration Code (2nd code)"; label variable A12 "Total No. of Persons Usually working: Adult Male"; label variable A13 "Total No. of Persons Usually working: Adult Female"; label variable A14 "Total No. of Persons Usually working: Children Male"; label variable A15 "Total No. of Persons Usually working: Children Female"; label variable A16 "Total No. of Persons Usually working: Total"; label variable A17 "Non Hired Persons Usually working: Adult Male"; label variable A18 "Non Hired Persons Usually working: Adult Female"; label variable A19 "Non Hired Persons Usually working: Children Male"; label variable A20 "Non Hired Persons Usually working: Children Female"; label variable A21 "Non Hired Persons Usually working: Total"; label variable A22 "Source of Finance"; label variable A23 "Address Slip attached"; la def 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 "Chhatisgarh" 23 "Madhya Pradesh" 24 "Gujarat" 25 "Daman & Diu" 26 "Dadra & Nagar Haveli" 27 "Maharashtra" 28 "Andhra Pradesh" 29 "Karnataka" 30 "Goa" 31 "Lakshadweep" 32 "Kerala" 33 "Tamil Nadu" 34 "Pondicherry" 35 "Andaman & Nicobar Island"; la def A2 1 "Without Premises" 2 "With Premises"; la def A7 1 "Perennial" 2 "Non Perennial"; la def A8 1 "Govt & PSU" 2 "Private enterprise: Non profit Insts" 3 "Private enterprise: Unincorporated proprietary" 4 "Private enterprise: Unincorporated partnership" 5 "Private enterprise: Corporate non financial" 6 "Private enterprise: Corporate financial" 7 "Private enterprise: Co-operative"; la def A9 1 "Female ST" 2 "Female SC" 3 "Female OBC" 4 "Female Other" 5 "Male ST" 6 "Male SC" 7 "Male OBC" 8 "Male Other" 9 "Other than private enterprise"; la def A10 1 "Without Power" 2 "Electricity" 3 "Coal/soft coke" 4 "petrol/diesel/kerosene" 5 "LPG/Natural Gas" 6 "Firewood" 7 "Animal Power" 8 "Non-conventional Energy" 9 "Others"; la def A11 0 "Not Registered" 1 "Registered Under: Factory Act 1948" 2 "Registered Under: State Directorate of Industries" 3 "Registered Under: KVIC/KVIV" 4 "Registered Under: Powerloom/Handloom/handicraft" 5 "Registered Under: Texttile Commissioner/Jute Commissioner/Coir Board/Central Silk Board" 6 "Registered Under: Central Excise/Sales Tax Act" 7 "Registered Under: Shop & Establishment Act" 8 "Registered Under: Co-operative Society/Labour Act" 9 "Registered Under: Registered with other agencies"; la def A22 0 "No finance/Self finance" 1 "Assistance from Govt. sources" 2 "Borrowing from Financial Institutions" 3 "Borrowing from Non-Institutions/Money lenders" 9 "Others (like NGOs, Voluntary ORGs)"; la def A23 1 "Yes" 2 "No"; la val ES1 state; la val A2 A2; la val A7 A7; la val A8 A8; la val A9 A9; la val A10 A10; la val A11a A11b A11; la val A22 A22; la val A23 A23; order ES0a ES0b ES0c ES1 ES2 ES13 ES14 ES15 ES23 ES24 ES25 ES26 ES27 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11a A11b A12 A13 A14 A15 A16 A17 A18 A19 A20 A21 A22 A23; save "$pathout\State_0`i'", replace; }; forvalues i=10/35 {; drop _all; infix str ES0a 1-2 str ES0b 3-3 str ES1 4-5 str ES2 6-7 str ES13 8-11 str ES14 12-19 str ES15 20-23 str ES0c 24-25 str A1 26-28 str A2 29-29 str A3 30-31 str A4 32-32 str A5 33-36 str A6 37-37 str A7 38-38 str A8 39-39 str A9 40-40 str A10 41-41 str A11a 42-42 str A11b 43-43 str A12 44-48 str A13 49-51 str A14 52-53 str A15 54-55 str A16 56-60 str A17 61-62 str A18 63-64 str A19 65-66 str A20 67-68 str A21 69-71 str A22 72-72 str A23 73-73 using "$pathin\ec05d`i'c.txt"; keep if ES0b=="1"; compress; save `tempR', replace; drop _all; infix str ES0a 1-2 str ES0b 3-3 str ES1 4-5 str ES2 6-7 str ES23 8-9 str ES24 10-11 str ES25 12-16 str ES26 17-21 str ES27 22-23 str ES0c 24-25 str A1 26-28 str A2 29-29 str A3 30-31 str A4 32-32 str A5 33-36 str A6 37-37 str A7 38-38 str A8 39-39 str A9 40-40 str A10 41-41 str A11a 42-42 str A11b 43-43 str A12 44-48 str A13 49-51 str A14 52-53 str A15 54-55 str A16 56-60 str A17 61-62 str A18 63-64 str A19 65-66 str A20 67-68 str A21 69-71 str A22 72-72 str A23 73-73 using "$pathin\ec05d`i'c.txt"; keep if ES0b=="2"; compress; save `tempU', replace; use `tempR', clear; append using `tempU'; destring *, replace; label variable ES0a "Schedule No."; label variable ES0b "Sector"; label variable ES1 "State-UT"; label variable ES2 "District"; label variable ES13 "Tehsil/Taluk/PS/Dev.Block/Circle/Panchayat etc."; label variable ES14 "Village"; label variable ES15 "Enumeration Block No."; label variable ES23 "Town"; label variable ES24 "Frame"; label variable ES25 "Ward No."; label variable ES26 "Investigator Unit No."; label variable ES27 "UFS Block No."; label variable ES0c "Page Number"; label variable A1 "Line No."; label variable A2 "Enterprise Premises Status Code No."; label variable A3 "Running Serial No of Enterprise within a page"; label variable A4 "Activity code (Major or Subsidiary)"; label variable A5 "Major activity NIC – 2004"; label variable A6 "Classification code (Agri or Non Agri)"; label variable A7 "Operation Code (Perennial or Not)"; label variable A8 "Ownership"; label variable A9 "Social Group of owner"; label variable A10 "Power/Fuel used for Enterprise activity"; label variable A11a "Registration Code (1st code)"; label variable A11b "Registration Code (2nd code)"; label variable A12 "Total No. of Persons Usually working: Adult Male"; label variable A13 "Total No. of Persons Usually working: Adult Female"; label variable A14 "Total No. of Persons Usually working: Children Male"; label variable A15 "Total No. of Persons Usually working: Children Female"; label variable A16 "Total No. of Persons Usually working: Total"; label variable A17 "Non Hired Persons Usually working: Adult Male"; label variable A18 "Non Hired Persons Usually working: Adult Female"; label variable A19 "Non Hired Persons Usually working: Children Male"; label variable A20 "Non Hired Persons Usually working: Children Female"; label variable A21 "Non Hired Persons Usually working: Total"; label variable A22 "Source of Finance"; label variable A23 "Address Slip attached"; la def 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 "Chhatisgarh" 23 "Madhya Pradesh" 24 "Gujarat" 25 "Daman & Diu" 26 "Dadra & Nagar Haveli" 27 "Maharashtra" 28 "Andhra Pradesh" 29 "Karnataka" 30 "Goa" 31 "Lakshadweep" 32 "Kerala" 33 "Tamil Nadu" 34 "Pondicherry" 35 "Andaman & Nicobar Island"; la def A2 1 "Without Premises" 2 "With Premises"; la def A7 1 "Perennial" 2 "Non Perennial"; la def A8 1 "Govt & PSU" 2 "Private enterprise: Non profit Insts" 3 "Private enterprise: Unincorporated proprietary" 4 "Private enterprise: Unincorporated partnership" 5 "Private enterprise: Corporate non financial" 6 "Private enterprise: Corporate financial" 7 "Private enterprise: Co-operative"; la def A9 1 "Female ST" 2 "Female SC" 3 "Female OBC" 4 "Female Other" 5 "Male ST" 6 "Male SC" 7 "Male OBC" 8 "Male Other" 9 "Other than private enterprise"; la def A10 1 "Without Power" 2 "Electricity" 3 "Coal/soft coke" 4 "petrol/diesel/kerosene" 5 "LPG/Natural Gas" 6 "Firewood" 7 "Animal Power" 8 "Non-conventional Energy" 9 "Others"; la def A11 0 "Not Registered" 1 "Registered Under: Factory Act 1948" 2 "Registered Under: State Directorate of Industries" 3 "Registered Under: KVIC/KVIV" 4 "Registered Under: Powerloom/Handloom/handicraft" 5 "Registered Under: Texttile Commissioner/Jute Commissioner/Coir Board/Central Silk Board" 6 "Registered Under: Central Excise/Sales Tax Act" 7 "Registered Under: Shop & Establishment Act" 8 "Registered Under: Co-operative Society/Labour Act" 9 "Registered Under: Registered with other agencies"; la def A22 0 "No finance/Self finance" 1 "Assistance from Govt. sources" 2 "Borrowing from Financial Institutions" 3 "Borrowing from Non-Institutions/Money lenders" 9 "Others (like NGOs, Voluntary ORGs)"; la def A23 1 "Yes" 2 "No"; la val ES1 state; la val A2 A2; la val A7 A7; la val A8 A8; la val A9 A9; la val A10 A10; la val A11a A11b A11; la val A22 A22; la val A23 A23; order ES0a ES0b ES0c ES1 ES2 ES13 ES14 ES15 ES23 ES24 ES25 ES26 ES27 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11a A11b A12 A13 A14 A15 A16 A17 A18 A19 A20 A21 A22 A23; save "$pathout\State_`i'", replace; };