diff --git a/GLD/LKA/LKA_1996_LFS/LKA_1996_LFS_V01_M_V03_A_GLD/Programs/LKA_1996_LFS_V01_M_V03_A_GLD_ALL.do b/GLD/LKA/LKA_1996_LFS/LKA_1996_LFS_V01_M_V03_A_GLD/Programs/LKA_1996_LFS_V01_M_V03_A_GLD_ALL.do new file mode 100644 index 000000000..e2bb8f681 --- /dev/null +++ b/GLD/LKA/LKA_1996_LFS/LKA_1996_LFS_V01_M_V03_A_GLD/Programs/LKA_1996_LFS_V01_M_V03_A_GLD_ALL.do @@ -0,0 +1,1808 @@ + +/*%%============================================================================================= + 0: GLD Harmonization Preamble +================================================================================================*/ + +/* ----------------------------------------------------------------------- +<_Program name_> LKA_1996_LFS_V01_M_V03_A_GLD_ALL.do +<_Application_> Stata SE 16.1 <_Application_> +<_Author(s)_> Wolrd Bank Job's Group +<_Date created_> 2023-08-19 +------------------------------------------------------------------------- +<_Country_> Sri Lanka (LKA) +<_Survey Title_> National Labour Force Survey +<_Survey Year_> 1996 +<_Study ID_> LKA_1996_LFS_v01_M +<_Data collection from (M/Y)_> [Jan/1996] +<_Data collection to (M/Y)_> [Oct/1996] +<_Source of dataset_> Survey conducted by LKA Department of + Census and Statistics, + Ministry Policy Planning and Implementation; + Data was acquired internally through I2D2. + Can be downloaded from http://nada.statistics.gov.lk/index.php/catalog but + with only 25% of the full file through registration. +<_Sample size (HH)_> 15,116 +<_Sample size (IND)_> 68,489 +<_Sampling method_> A stratified two-stage probability sample design + used with census blocks as PSUs and housing units + as secondary and final sampling units. +<_Geographic coverage_> 7 provinces devided into urban and rural areas + and the greater colombo area. Northern and Eastern + provinces were excluded. + 17 districts: + - Greater Colombo (Colombo MC+Dehiwela-Mt.Lavinia MC+Kotte UC) + - Western Province (Remainder) + - Southern Province + - North Western Province + - North Central Province + - Uva Province + - Sabaragamuwa Province +<_Currency_> Sri Lanka Rupee +----------------------------------------------------------------------- +<_ICLS Version_> ICLS 19 +<_ISCED Version_> ISCED-2011 +<_ISCO Version_> ISCO 88 +<_OCCUP National_> N/A +<_ISIC Version_> ISIC Rev.3 +<_INDUS National_> N/A +----------------------------------------------------------------------- + +<_Version Control_> + +* Date: [YYYY-MM-DD] File: [As in Program name above] - [Description of changes] +* Date: [YYYY-MM-DD] File: [As in Program name above] - [Description of changes] +* Date: 2024-03-22 - Update vars icls_v +* Date: 2024-10-08 - Update var whours + + + +-------------------------------------------------------------------------*/ + + +/*%%============================================================================================= + 1: Setting up of program environment, dataset +================================================================================================*/ + +*----------1.1: Initial commands------------------------------* + +clear +set more off +set mem 800m + +*----------1.2: Set directories------------------------------* + +* Define path sections +local server "Y:/GLD" +local country "LKA" +local year "1996" +local survey "LFS" +local vermast "V01" +local veralt "V03" + +* From the definitions, set path chunks +local level_1 "`country'_`year'_`survey'" +local level_2_mast "`level_1'_`vermast'_M" +local level_2_harm "`level_1'_`vermast'_M_`veralt'_A_GLD" + +* From chunks, define path_in, path_output folder +local path_in_stata "`server'/`country'/`level_1'/`level_2_mast'/Data/Stata" +local path_in_other "`server'/`country'/`level_1'/`level_2_mast'/Data/Original" +local path_output "`server'/`country'/`level_1'/`level_2_harm'/Data/Harmonized" + +* Define Output file name +local out_file "`level_2_harm'_ALL.dta" + + +*----------1.3: Database assembly------------------------------* + +* All steps necessary to merge datasets (if several) to have all elements needed to produce +* harmonized output in a single file + + use "`path_in_stata'/lfs1996_orig", clear + +/*%%============================================================================================= + 2: Survey & ID +================================================================================================*/ + +{ + +*<_countrycode_> + gen str4 countrycode="`country'" + label var countrycode "Country code" +* + + +*<_survname_> + gen survname="LFS" + label var survname "Survey acronym" +* + + +*<_survey_> + gen survey="LFS" + label var survey "Survey type" +* + + +*<_icls_v_> + gen icls_v="ICLS-13" +* + + +*<_isced_version_> + gen isced_version="isced_2011" + label var isced_version "Version of ISCED used for educat_isced" +* + + +*<_isco_version_> + gen isco_version="" + label var isco_version "Version of ISCO used" +* + + +*<_isic_version_> + gen isic_version="" + label var isic_version "Version of ISIC used" +* + + +*<_year_> + drop year + gen int year=`year' + label var year "Year of survey" +* + + +*<_vermast_> + gen str3 vermast="`vermast'" + label var vermast "Version of master data" +* + + +*<_veralt_> + gen str3 veralt="`veralt'" + label var veralt "Version of the alt/harmonized data" +* + + +*<_harmonization_> + gen harmonization="GLD" + label var harmonization "Type of harmonization" +* + + +*<_int_year_> + gen int_year=`year' + label var int_year "Year of the interview" +* + + +*<_int_month_> + gen int_month=month + label de lblint_month 1 "January" 2 "February" 3 "March" 4 "April" 5 "May" 6 "June" 7 "July" 8 "August" 9 "September" 10 "October" 11 "November" 12 "December" + label value int_month lblint_month + label var int_month "Month of the interview" +* + + +*<_hhid_> + foreach v of varlist month sector district { + tostring `v', gen(`v'_str) format(%02.0f) + } + tostring hhid, gen(hhid_orig) format(%03.0f) + tostring psu_no, gen(psu_no_str) format(%03.0f) + rename hhid hid + egen hhid=concat(month_str sector_str district_str psu_no_str hhid_orig) + label var hhid "Household id" +* + + +*<_pid_> + +/*<_pid_note_> + +Duplicates in terms of hhid p1 +-------------------------------------- + copies | observations surplus +----------+--------------------------- + 1 | 68475 0 + 2 | 10 5 + 4 | 4 3 +-------------------------------------- + +Within the same household there are duplicated household IDs + +*<_pid_note_>*/ + + gsort hhid -age + bys hhid: gen newp1=_n + tostring newp1, gen(str_pid) format(%02.0f) + egen pid=concat(hhid str_pid), punct("-") + label var pid "Individual ID" +* + + +*<_weight_> + *gen weight=wt_hh + label var weight "Household sampling weight" +* + + +*<_psu_> + egen psu=concat(month_str sector_str district_str psu_no_str) + label var psu "Primary sampling units" +* + + +*<_ssu_> + gen ssu=hhid + label var ssu "Secondary sampling units" +* + + +*<_strata_> + egen strata=concat(sector_str district_str) + label var strata "Strata" +* + + +*<_wave_> + gen wave=. + replace wave=1 if month==1 + replace wave=2 if month==4 + replace wave=3 if month==7 + replace wave=4 if month==10 + label var wave "Survey wave" +* + + +*<_panel_> + gen panel="" + label var panel "Panel individual belongs to" +* + + +*<_visit_no_> + gen visit_no=. + label var visit_no "Visit number in panel" +* +} + +/*%%============================================================================================= + 3: Geography +================================================================================================*/ + +{ + +*<_urban_> + gen urban=. + replace urban=1 if sector==1 + replace urban=0 if sector==2|sector==3 + la de lblurban 1 "Urban" 0 "Rural" + label values urban lblurban + label var urban "Location is urban" +* + + +*<_subnatid1_> + +/*<_subnatid1_note_> + +In 1996, Northern and Eastern provinces were excluded. + +*<_subnatid1_note_>*/ + gen subnatid1_num=district + recode subnatid1_num (1/3=1) (4/6=2) (7/9=3) (10/14=4) (15/17=5) (18/19=6) (20/21=7) (22/23=8) (24/25=9) + gen subnatid1="" + replace subnatid1="1 - Western" if subnatid1_num==1 + replace subnatid1="2 - Central" if subnatid1_num==2 + replace subnatid1="3 - Southern" if subnatid1_num==3 + replace subnatid1="4 - Northern Area" if subnatid1_num==4 + replace subnatid1="5 - Eastern" if subnatid1_num==5 + replace subnatid1="6 - North-western" if subnatid1_num==6 + replace subnatid1="7 - North-central" if subnatid1_num==7 + replace subnatid1="8 - Uva" if subnatid1_num==8 + replace subnatid1="9 - Sabaragamuwa" if subnatid1_num==9 + label var subnatid1 "Subnational ID at First Administrative Level" +* + + +*<_subnatid2_> + gen subnatid2_num=district + recode subnatid2_num (1=11) (2=12) (3=13) (4=21) (5=22) (6=23) (7=31) (8=32) (9=33) (18=61) (19=62) (20=71) (21=72) (22=81) (23=82) (24=91) (25=92) + label de lblsubnatid2 11 "11-Colombo" 12 "12-Gampaha" 13 "13-Kalutara" 21 "21-Kandy" 22 "22-Matale" 23 "23-Nuwara Eliya" 31 "31-Galle" 32 "32-Matara" 33 "33-Hambantota" 41 "41-Jaffna" 42 "42-Kilinochchi" 43 "43-Mannar" 51 "51-Batticaloa" 53 "53-Trincomalee" 61 "61-Kurunegala" 62 "62-Puttalam" 71 "71-Anradhapura" 72 "72-Polonnaruwa" 81 "81-Badulla" 82 "82-Moneragala" 91 "91-Ratnapura" 92 "92-Kegalle" + label values subnatid2_num lblsubnatid2 + decode (subnatid2_num), gen(subnatid2) + label var subnatid2 "Subnational ID at Second Administrative Level" + drop subnatid2_num +* + + +*<_subnatid3_> + gen subnatid3="" + label var subnatid3 "Subnational ID at Third Administrative Level" +* + + +*<_subnatidsurvey_> + decode urban, gen(urban_name) + egen subnatidsurvey=concat(subnatid2 urban_name), punct("-") + replace subnatidsurvey="" if subnatidsurvey=="-" + label var subnatidsurvey "Administrative level at which survey is representative" +* + + +*<_subnatid1_prev_> + +/* <_subnatid1_prev_note_> +subnatid1_prev is coded as missing unless the classification used for subnatid1 has changed since the previous survey. + */ + + gen subnatid1_prev=. + label var subnatid1_prev "Classification used for subnatid1 from previous survey" +* + + +*<_subnatid2_prev_> + gen subnatid2_prev=. + label var subnatid2_prev "Classification used for subnatid2 from previous survey" +* + + +*<_subnatid3_prev_> + gen subnatid3_prev=. + label var subnatid3_prev "Classification used for subnatid3 from previous survey" +* + + +*<_gaul_adm1_code_> + gen gaul_adm1_code=. + label var gaul_adm1_code "Global Administrative Unit Layers (GAUL) Admin 1 code" +* + + +*<_gaul_adm2_code_> + gen gaul_adm2_code=. + label var gaul_adm2_code "Global Administrative Unit Layers (GAUL) Admin 2 code" +* + + +*<_gaul_adm3_code_> + gen gaul_adm3_code=. + label var gaul_adm3_code "Global Administrative Unit Layers (GAUL) Admin 3 code" +* + +} + +/*%%============================================================================================= + 4: Demography +================================================================================================*/ + +{ + +*<_hsize_> + bys hhid: egen hsize=max(newp1) + label var hsize "Household size" +* + + +*<_age_> + *gen age=. + replace age=98 if age>98 & age!=. + label var age "Individual age" +* + + +*<_male_> + gen male=sex if inrange(sex,1,2) + recode male 2=0 + label var male "Sex - Ind is male" + la de lblmale 1 "Male" 0 "Female" + label values male lblmale +* + + +*<_relationharm_> + gen byte relationharm=p3 + recode relationharm (7/9=6) + label var relationharm "Relationship to the head of household - Harmonized" + la de lblrelationharm 1 "Head of household" 2 "Spouse" 3 "Children" 4 "Parents" 5 "Other relatives" 6 "Other and non-relatives" + label values relationharm lblrelationharm + + gen head=1 if relationharm==1 + bys hhid: egen headsum=total(head) + gen relative=1 if inrange(relationharm,1,5) + replace relative=0 if relative!=1 + bys hhid: egen any=total(relative) + bys hhid: egen olderest=max(age) if !mi(age)&relationharm!=6 + bys hhid: egen pidmin=min(newp1) + replace relationharm=1 if relationharm!=6&headsum==0&p1==1&age>17 + replace relationharm=1 if headsum==0&newp1==pidmin&age>17&relationharm!=5 + replace head=1 if relationharm==1 + bys hhid: egen headsum0=total(head) + + gsort hhid relationharm -age + bys hhid: gen count=_n + replace relationharm=1 if headsum0==0&count==1 + replace head=1 if relationharm==1 + bys hhid: egen headsum1=total(head) + + replace relationharm=5 if headsum1==2&head==1&age<18&age!=olderest + bys hhid relationharm: egen headagemax=max(age) + bys hhid relationharm: replace relationharm=5 if headsum1==2&head==1&age!=headagemax + bys hhid relationharm: egen headidmin=min(newp1) + replace relationharm=5 if headsum1==2&head==1&newp1!=headidmin + replace head=. if relationharm!=1 + bys hhid: egen headsum2=total(head) + + replace relationharm=5 if headsum2&head==1&newp1!=headidmin + drop head-headsum2 +* + + +*<_relationcs_> + gen relationcs=p3 + label var relationcs "Relationship to the head of household - Country original" +* + + +*<_marital_> + gen byte marital=p8 + recode marital (1=2) (2=1) (3=5) (5=4) + label var marital "Marital status" + la de lblmarital 1 "Married" 2 "Never Married" 3 "Living together" 4 "Divorced/Separated" 5 "Widowed" + label values marital lblmarital +* + + +*<_eye_dsablty_> + gen eye_dsablty=. + la de lbleye_dsablty 1 "No" 2 "Yes-some" 3 "Yes-a lot" 4 "Cannot at all" + label values eye_dsablty lbleye_dsablty + label var eye_dsablty "Disability related to eyesight" +* + + +*<_hear_dsablty_> + gen hear_dsablty=. + la de lblhear_dsablty 1 "No" 2 "Yes-some" 3 "Yes-a lot" 4 "Cannot at all" + label values hear_dsablty lblhear_dsablty + label var hear_dsablty "Disability related to hearing" +* + + +*<_walk_dsablty_> + gen walk_dsablty=. + la de lblwalk_dsablty 1 "No" 2 "Yes-some" 3 "Yes-a lot" 4 "Cannot at all" + label values walk_dsablty lblwalk_dsablty + label var walk_dsablty "Disability related to walking or climbing stairs" +* + + +*<_conc_dsord_> + gen conc_dsord=. + la de lblconc_dsord 1 "No" 2 "Yes-some" 3 "Yes-a lot" 4 "Cannot at all" + label values conc_dsord lblconc_dsord + label var conc_dsord "Disability related to concentration or remembering" +* + + +*<_slfcre_dsablty_> + gen slfcre_dsablty=. + la de lblslfcre_dsablty 1 "No" 2 "Yes-some" 3 "Yes-a lot" 4 "Cannot at all" + label values slfcre_dsablty lblslfcre_dsablty + label var eye_dsablty "Disability related to selfcare" +* + + +*<_comm_dsablty_> + gen comm_dsablty=. + la de lblcomm_dsablty 1 "No" 2 "Yes-some" 3 "Yes-a lot" 4 "Cannot at all" + label values comm_dsablty lblcomm_dsablty + label var eye_dsablty "Disability related to communicating" +* + +} + + +/*%%============================================================================================= + 5: Migration +================================================================================================*/ + +{ +*<_migrated_mod_age_> + gen migrated_mod_age=. + label var migrated_mod_age "Migration module application age" +* + + +*<_migrated_ref_time_> + gen migrated_ref_time=. + label var migrated_ref_time "Reference time applied to migration questions" +* + + +*<_migrated_binary_> + gen migrated_binary=. + label de lblmigrated_binary 0 "No" 1 "Yes" + replace migrated_binary=. if age + +*<_migrated_years_> + gen migrated_years=. + replace migrated_years=. if migrated_binary!=1 + replace migrated_years=. if age + + +*<_migrated_from_urban_> + gen migrated_from_urban=. + replace migrated_from_urban=. if age + + +*<_migrated_from_cat_> + gen migrated_from_cat=. + replace migrated_from_cat=. if age + + +*<_migrated_from_code_> + gen migrated_from_code=. + replace migrated_from_code=. if migrated_binary!=1 + replace migrated_from_code=. if age + + +*<_migrated_from_country_> + gen migrated_from_country="" + replace migrated_from_country="" if migrated_binary!=1 + replace migrated_from_country="" if age + + +*<_migrated_reason_> + gen migrated_reason=. + replace migrated_reason=. if migrated_binary!=1 + replace migrated_reason=. if age +} + + +/*%%============================================================================================= + 6: Education +================================================================================================*/ + + +{ +*<_ed_mod_age_> + gen byte ed_mod_age=5 + label var ed_mod_age "Education module application age" +* + + +*<_school_> + gen school=. + replace school=0 if schooling==5 + replace school=1 if inrange(schooling,1,4) + replace school=. if age + + +*<_literacy_> + gen byte literacy=. + replace literacy=. if age + + +*<_educy_> + +/*<_educy_note_> + +Original categorization of the highest educational level ever attended of +variable educattn is: + +0 Studying Year 1 +1 Passed Year 1 +2 Passed Year 2/Grade 1 +3 Passed Year 3/Grade 2 +4 Passed Year 4/Grade 3 +5 Passed Year 5/Grade 4 --- primary education complete +6 Passed Year 6/Grade 5 +7 Passed Year 7/Grade 6 +8 Passed Year 8/Grade 7 +9 Passed Year 9/Grade 8 --- lower secondary complete +10 Passed Year 10/Grade 9 +11 Passed Year 11/GCE(O.L)/NCGE --- (upper secondary) +12 Passed Year 12/Grade 11 --- (upper secondary) +13 Passed Year 13/GCE(A.L)/HNCE --- (upper secondary graduated) +14 Passed GAQ/GSQ --- General Arts Qualification, above secondary but not University 16 years +15 Degree --- 18 years +16 Post Graduate Degree/Diploma --- 19 years +19 No shcooling + +The other education-related variable is schooling: +Attendance at school or other educational institution +1. School +2. University +3. Other educational institution +4. Vocational/Technical institution +5. Does not attend + +*<_educy_note_>*/ + + gen byte educy=. + replace educy=educattn if inrange(educattn,0,13) + replace educy=16 if educattn==14 + replace educy=18 if educattn==15 + replace educy=19 if educattn==16 + replace educy=0 if educattn==19 + replace educy=. if ageage & !mi(educy) & !mi(age) + label var educy "Years of education" +* + + +*<_educat7_> + gen byte educat7=. + replace educat7=1 if educattn==19 + replace educat7=2 if inrange(educattn,0,4) + replace educat7=3 if educattn==5 + replace educat7=4 if inrange(educattn,6,10) + replace educat7=5 if inrange(educattn,11,13) + replace educat7=6 if educattn==14 + replace educat7=7 if inlist(educattn,15,16) + replace educat7=. if age + + +*<_educat5_> + gen byte educat5=educat7 + recode educat5 (4=3) (5=4) (6 7=5) + replace educat5=. if age + + +*<_educat4_> + gen byte educat4=educat5 + replace educat4=. if age + + +*<_educat_orig_> + gen educat_orig=educattn + label var educat_orig "Original survey education code" +* + + +*<_educat_isced_> + gen educat_isced=. + replace educat_isced=100 if inrange(educattn,0,5) + replace educat_isced=244 if inrange(educattn,6,9) + replace educat_isced=343 if educattn==10|educattn==11 + replace educat_isced=344 if educattn==12|educattn==13 + replace educat_isced=660 if educattn==18 + replace educat_isced=760 if educattn==19 + replace educat_isced=. if age + + +*<_educat_isced_v_> + gen educat_isced_v="ISCED-2011" + label var educat_isced_v "Version of the ISCED used" +* + +*----------6.1: Education cleanup------------------------------* + +*<_% Correction min age_> + +** Drop info for cases under the age for which questions to be asked (do not need a variable for this) +local ed_var school literacy educy educat7 educat5 educat4 educat_isced +foreach v of local ed_var { + replace `v'=. if ( age < ed_mod_age & !missing(age) ) +} +replace educat_isced_v="." if ( age < ed_mod_age & !missing(age) ) +* + +} + +/*%%============================================================================================= + 7: Training +================================================================================================*/ + + +{ + +*<_vocational_> + +/*<_vocational_note_> + +Original variables P13-P17 are supposed to be questions about vocational training. +However, the categorization of binary questions does not seem right. +The whole section's variables and their categories see dubious so we did not code this section. + +*<_vocational_note_>*/ + + gen vocational=. + replace vocational=. if age<10 + la de vocationallbl 1 "Yes" 0 "No" + la values vocational vocationallbl + label var vocational "Ever received vocational training" +* + + +*<_vocational_type_> + gen vocational_type=. + label de lblvocational_type 1 "Inside Enterprise" 2 "External" + label values vocational_type lblvocational_type + label var vocational_type "Type of vocational training" +* + + +*<_vocational_length_l_> + gen vocational_length_l=. + replace vocational_length_l=. if age<10|vocational!=1 + label var vocational_length_l "Length of training in months, lower limit" +* + + +*<_vocational_length_u_> + gen vocational_length_u=. + replace vocational_length_l=. if age<10|vocational!=1 + label var vocational_length_u "Length of training in months, upper limit" +* + + +*<_vocational_field_orig_> + gen vocational_field_orig=. + replace vocational_field_orig=. if age<10|vocational!=1 + label var vocational_field_orig "Original field of training information" +* + + +*<_vocational_financed_> + gen vocational_financed=. + label de lblvocational_financed 1 "Employer" 2 "Government" 3 "Mixed Employer/Government" 4 "Own funds" 5 "Other" + label var vocational_financed "How training was financed" +* + +} + +/*%%============================================================================================= + 8: Labour +================================================================================================*/ + +*<_minlaborage_> + gen byte minlaborage=10 + label var minlaborage "Labor module application age" +* + + +*----------8.1: 7 day reference overall------------------------------* + +{ +*<_lstatus_> + gen byte lstatus=. + replace lstatus=1 if worked==1|q3==1|q6==1 + replace lstatus=2 if worked==2&q3==2&q4==1&q5==1 + replace lstatus=3 if lstatus==. + replace lstatus=. if age + + +*<_potential_lf_> + +/*<_potential_lf_note_> +Note: var "potential_lf" only takes value if the respondent is not in labor force. (lstatus==3) + +"potential_lf"=1 if the person is +1)available but not searching or q5==1 & q4==2 +2)searching but not immediately available to work or q5==2 & q4==1 + +*/ + + gen potential_lf=. + replace potential_lf=1 if [q5==1 & q4==2] | [q5==2 & q4==1] + replace potential_lf=0 if [q5==1 & q4==1] | [q5==2 & q4==2] + replace potential_lf=. if age < minlaborage + replace potential_lf=. if lstatus!=3 + label var potential_lf "Potential labour force status" + la de lblpotential_lf 0 "No" 1 "Yes" + label values potential_lf lblpotential_lf +* + + +*<_underemployment_> + gen byte underemployment=. + replace underemployment=. if age + + +*<_nlfreason_> + gen byte nlfreason=q7 + recode nlfreason (6=5) + replace nlfreason=. if age + + +*<_unempldur_l_> + gen byte unempldur_l=q27 + replace unempldur_l=. if age + + +*<_unempldur_u_> + gen byte unempldur_u=q27 + replace unempldur_u=. if age +} + + +*----------8.2: 7 day reference main job------------------------------* + + +{ +*<_empstat_> + gen byte empstat=q9D + recode empstat (2=3) (3=4) (4=2) + replace empstat=. if lstatus!=1|age + + +*<_ocusec_> + +/*<_ocusec_note_> + +Original variable q9C only has two categories: public vs. private + +*<_ocusec_note_>*/ + + gen byte ocusec=q9C + replace ocusec=. if lstatus!=1|age + + +*<_industry_orig_> + gen industry_orig=q9A + replace industry_orig=. if lstatus!=1 + label var industry_orig "Original survey industry code, main job 7 day recall" +* + + +*<_industrycat_isic_> + gen industrycat_isic="" + replace industrycat_isic="" if industrycat_isic=="." + replace industrycat_isic="" if lstatus!=1 + label var industrycat_isic "ISIC code of primary job 7 day recall" +* + + +*<_industrycat10_> + gen long industrycat10=. + replace industrycat10=. if lstatus!=1 + label var industrycat10 "1 digit industry classification, primary job 7 day recall" + la de lblindustrycat10 1 "Agriculture" 2 "Mining" 3 "Manufacturing" 4 "Public utilities" 5 "Construction" 6 "Commerce" 7 "Transport and Comnunications" 8 "Financial and Business Services" 9 "Public Administration" 10 "Other Services, Unspecified" + label values industrycat10 lblindustrycat10 +* + + +*<_industrycat4_> + gen byte industrycat4=industrycat10 + recode industrycat4 (1=1)(2 3 4 5=2)(6 7 8 9=3)(10=4) + label var industrycat4 "1 digit industry classification (Broad Economic Activities), primary job 7 day recall" + la de lblindustrycat4 1 "Agriculture" 2 "Industry" 3 "Services" 4 "Other" + label values industrycat4 lblindustrycat4 +* + + +*<_occup_orig_> + gen occup_orig=q9B + replace occup_orig=. if lstatus!=1 + label var occup_orig "Original occupation record primary job 7 day recall" +* + + +*<_occup_isco_> + gen str4 occup_isco="" + replace occup_isco="" if lstatus!=1 | occup_isco=="." + label var occup_isco "ISCO code of primary job 7 day recall" +* + + +*<_occup_skill_> + gen skill_level=substr(occup_isco, 1, 1) + destring skill_level, replace + gen occup_skill=. + replace occup_skill=1 if skill_level==9 + replace occup_skill=2 if inrange(skill_level, 4, 8) + replace occup_skill=3 if inrange(skill_level, 1, 3) + replace occup_skill=. if skill_level==0 | lstatus!=1 + la de lblskill 1 "Low skill" 2 "Medium skill" 3 "High skill" + label values occup_skill lblskill + label var occup_skill "Skill based on ISCO standard primary job 7 day recall" +* + + +*<_occup_> + gen occup=. + replace occup=. if lstatus!=1 + label var occup "1 digit occupational classification, primary job 7 day recall" + la de lbloccup 1 "Managers" 2 "Professionals" 3 "Technicians" 4 "Clerks" 5 "Service and market sales workers" 6 "Skilled agricultural" 7 "Craft workers" 8 "Machine operators" 9 "Elementary occupations" 10 "Armed forces" 99 "Others" + label values occup lbloccup +* + + +*<_wage_no_compen_> + +/*<_wage_no_compen_note_> + +Question 40 asks whether the respondent has in-kind compensation. But it only +has answers of yes or no. No numbers of the in-kind value. + +*<_wage_no_compen_note_>*/ + + gen double wage_no_compen=earnings + recode wage_no_compen 9999=. + replace wage_no_compen=. if lstatus!=1|empstat==2 + label var wage_no_compen "Last wage payment primary job 7 day recall" +* + + +*<_unitwage_> + gen byte unitwage=5 + replace unitwage=. if lstatus!=1 | empstat==2 + label var unitwage "Last wages' time unit primary job 7 day recall" + la de lblunitwage 1 "Daily" 2 "Weekly" 3 "Every two weeks" 4 "Bimonthly" 5 "Monthly" 6 "Trimester" 7 "Biannual" 8 "Annually" 9 "Hourly" 10 "Other" + label values unitwage lblunitwage +* + + +*<_whours_> + +/*<_whours_note_> + +Q13 is hours usually worked, Q14 hours actually worked. We have coded Q14 in all the series. In the close by years (1995 +and 1998) nearly all employed people answer Q14 (and as many answer Q14 as Q13). For some odd reason, this year only 50% of +respondents answer Q14. Hence here we will use Q13 to fill in the blanks. + +*<_whours_note_>*/ + + gen whours = q14 + replace whours = q13 if !mi(q13) & mi(q14) + replace whours = . if lstatus!=1 + replace whours = . if whours == 0 + label var whours "Hours of work in last week primary job 7 day recall" +* + + +*<_wmonths_> + gen wmonths=. + label var wmonths "Months of work in past 12 months primary job 7 day recall" +* + + +*<_wage_total_> + gen wage_total=. + label var wage_total "Annualized total wage primary job 7 day recall" +* + + +*<_contract_> + gen byte contract=. + replace contract=. if lstatus!=1 + label var contract "Employment has contract primary job 7 day recall" + la de lblcontract 0 "Without contract" 1 "With contract" + label values contract lblcontract +* + + +*<_healthins_> + gen byte healthins=. + replace healthins=. if lstatus!=1 + label var healthins "Employment has health insurance primary job 7 day recall" + la de lblhealthins 0 "Without health insurance" 1 "With health insurance" + label values healthins lblhealthins +* + + +*<_socialsec_> + gen byte socialsec=. + replace socialsec=. if lstatus!=1 + label var socialsec "Employment has social security insurance primary job 7 day recall" + la de lblsocialsec 1 "With social security" 0 "Without social secturity" + label values socialsec lblsocialsec +* + + +*<_union_> + gen byte union=. + replace union=. if lstatus!=1 + label var union "Union membership at primary job 7 day recall" + la de lblunion 0 "Not union member" 1 "Union member" + label values union lblunion +* + + +*<_firmsize_l_> + gen byte firmsize_l=. + replace firmsize_l=. if lstatus!=1 + label var firmsize_l "Firm size (lower bracket) primary job 7 day recall" +* + + +*<_firmsize_u_> + gen byte firmsize_u=. + replace firmsize_u=. if lstatus!=1 + label var firmsize_u "Firm size (upper bracket) primary job 7 day recall" +* + +} + + +*----------8.3: 7 day reference secondary job------------------------------* +* Since labels are the same as main job, values are labelled using main job labels + +{ +*<_empstat_2_> + +/*<_empstat_2_note_> + +The original variable q18D has other mistaken categories such as 0, and 5-8. + +*<_empstat_2_note_>*/ + + gen byte empstat_2=q18D if inrange(q18D,1,4) + recode empstat_2 (2=3) (3=4) (4=2) + replace empstat_2=. if lstatus!=1|q17!=1 + label var empstat_2 "Employment status during past week secondary job 7 day recall" + la de lblempstat_2 1 "Paid employee" 2 "Non-paid employee" 3 "Employer" 4 "Self-employed" 5 "Other, workers not classifiable by status" + label values empstat_2 lblempstat +* + + +*<_ocusec_2_> + gen byte ocusec_2=q18C if inrange(q18C,1,2) + replace ocusec_2=. if lstatus!=1|q17!=1 + label var ocusec_2 "Sector of activity secondary job 7 day recall" + la de lblocusec_2 1 "Public Sector, Central Government, Army" 2 "Private, NGO" 3 "State owned" 4 "Public or State-owned, but cannot distinguish" + label values ocusec_2 lblocusec_2 +* + + +*<_industry_orig_2_> + gen industry_orig_2=q18A + replace industry_orig_2=. if lstatus!=1|q17!=1 + label var industry_orig_2 "Original survey industry code, secondary job 7 day recall" +* + + +*<_industrycat_isic_2_> + gen industrycat_isic_2="" + replace industrycat_isic_2="" if industrycat_isic_2=="." + replace industrycat_isic_2="" if lstatus!=1|q17!=1 + label var industrycat_isic_2 "ISIC code of secondary job 7 day recall" +* + + +*<_industrycat10_2_> + gen long industrycat10_2=. + replace industrycat10_2=. if lstatus!=1|q17!=1 + label var industrycat10_2 "1 digit industry classification, secondary job 7 day recall" + label values industrycat10_2 lblindustrycat10 +* + + +*<_industrycat4_2_> + gen byte industrycat4_2=industrycat10_2 + recode industrycat4_2 (1=1)(2 3 4 5 =2)(6 7 8 9=3)(10=4) + label var industrycat4_2 "1 digit industry classification (Broad Economic Activities), secondary job 7 day recall" + label values industrycat4_2 lblindustrycat4 +* + + +*<_occup_orig_2_> + gen occup_orig_2=q18B + replace occup_orig_2=. if lstatus!=1|q17!=1 + label var occup_orig_2 "Original occupation record secondary job 7 day recall" +* + + +*<_occup_isco_2_> + gen str4 occup_isco_2="" + replace occup_isco_2="" if occup_isco_2=="." + replace occup_isco_2="" if lstatus!=1|q17!=1 + label var occup_isco_2 "ISCO code of secondary job 7 day recall" +* + + +*<_occup_skill_2_> + gen skill_level_2=substr(occup_isco_2,1,1) + destring skill_level_2, replace + gen occup_skill_2=. + replace occup_skill_2=1 if skill_level_2==9 + replace occup_skill_2=2 if inrange(skill_level_2,4,8) + replace occup_skill_2=3 if inrange(skill_level_2,1,3) + replace occup_skill_2=. if skill_level_2==0|lstatus!=1|q17!=1 + label var occup_skill_2 "Skill based on ISCO standard secondary job 7 day recall" +* + + +*<_occup_2_> + gen occup_2=. + replace occup_2=. if lstatus!=1|q17!=1 + label var occup_2 "1 digit occupational classification secondary job 7 day recall" + label values occup_2 lbloccup +* + + +*<_wage_no_compen_2_> + gen double wage_no_compen_2=q42A + replace wage_no_compen_2=. if lstatus!=1|q17!=1|empstat_2==2 + label var wage_no_compen_2 "Last wage payment secondary job 7 day recall" +* + + +*<_unitwage_2_> + gen byte unitwage_2=5 + replace unitwage_2=. if lstatus!=1|q17!=1 + label var unitwage_2 "Last wages' time unit secondary job 7 day recall" + label values unitwage_2 lblunitwage +* + + +*<_whours_2_> + gen whours_2=q20 + replace whours_2=. if lstatus!=1|q17!=1 + label var whours_2 "Hours of work in last week secondary job 7 day recall" +* + + +*<_wmonths_2_> + gen wmonths_2=. + label var wmonths_2 "Months of work in past 12 months secondary job 7 day recall" +* + + +*<_wage_total_2_> + gen wage_total_2=. + label var wage_total_2 "Annualized total wage secondary job 7 day recall" +* + + +*<_firmsize_l_2_> + gen byte firmsize_l_2=. + label var firmsize_l_2 "Firm size (lower bracket) secondary job 7 day recall" +* + + +*<_firmsize_u_2_> + gen byte firmsize_u_2=. + label var firmsize_u_2 "Firm size (upper bracket) secondary job 7 day recall" +* + +} + +*----------8.4: 7 day reference additional jobs------------------------------* + +*<_t_hours_others_> + gen t_hours_others=. + label var t_hours_others "Annualized hours worked in all but primary and secondary jobs 7 day recall" +* + + +*<_t_wage_nocompen_others_> + gen t_wage_nocompen_others=. + label var t_wage_nocompen_others "Annualized wage in all but primary & secondary jobs excl. bonuses, etc. 7 day recall" +* + + +*<_t_wage_others_> + gen t_wage_others=. + label var t_wage_others "Annualized wage in all but primary and secondary jobs (12-mon ref period)" +* + + +*----------8.5: 7 day reference total summary------------------------------* + + +*<_t_hours_total_> + gen t_hours_total=. + label var t_hours_total "Annualized hours worked in all jobs 7 day recall" +* + + +*<_t_wage_nocompen_total_> + gen t_wage_nocompen_total=. + label var t_wage_nocompen_total "Annualized wage in all jobs excl. bonuses, etc. 7 day recall" +* + + +*<_t_wage_total_> + gen t_wage_total=. + label var t_wage_total "Annualized total wage for all jobs 7 day recall" +* + + +*----------8.6: 12 month reference overall------------------------------* + +{ +*<_lstatus_year_> + +/*<_lstatus_year_note_> + +The questionnaire has two reference periods: + +when aksed with "current", i.e. currently employed -- 7-day reference period +when aksed with "usually", i.e. hours usually work -- 12-month reference period + +And people who reported employed yet worked for less than 26 weeks in the past year +are classified as unemployed as well. + +*<_lstatus_year_note_>*/ + + gen byte lstatus_year=. + replace lstatus_year=1 if q33==1 + replace lstatus_year=2 if q33==2&q36==1 + replace lstatus_year=3 if lstatus_year==. + replace lstatus_year=. if age + + +*<_potential_lf_year_> + gen byte potential_lf_year=. + replace potential_lf_year=. if age + + +*<_underemployment_year_> + gen byte underemployment_year=. + replace underemployment_year=. if age + + +*<_nlfreason_year_> + gen byte nlfreason_year=. + label var nlfreason_year "Reason not in the labor force" + la de lblnlfreason_year 1 "Student" 2 "Housekeeper" 3 "Retired" 4 "Disable" 5 "Other" + label values nlfreason_year lblnlfreason_year +* + + +*<_unempldur_l_year_> + gen byte unempldur_l_year=. + label var unempldur_l_year "Unemployment duration (months) lower bracket" +* + + +*<_unempldur_u_year_> + gen byte unempldur_u_year=. + label var unempldur_u_year "Unemployment duration (months) upper bracket" +* + +} + +*----------8.7: 12 month reference main job------------------------------* + +{ +*<_empstat_year_> + gen byte empstat_year=. + replace empstat_year=. if q33!=1 + label var empstat_year "Employment status during past week primary job 12 month recall" + la de lblempstat_year 1 "Paid employee" 2 "Non-paid employee" 3 "Employer" 4 "Self-employed" 5 "Other, workers not classifiable by status" + label values empstat_year lblempstat_year +* + + +*<_ocusec_year_> + gen byte ocusec_year=. + replace ocusec_year=. if q33!=1 + label var ocusec_year "Sector of activity primary job 12 day recall" + la de lblocusec_year 1 "Public Sector, Central Government, Army" 2 "Private, NGO" 3 "State owned" 4 "Public or State-owned, but cannot distinguish" + label values ocusec_year lblocusec_year +* + + +*<_industry_orig_year_> + gen industry_orig_year=. + label var industry_orig_year "Original industry record main job 12 month recall" +* + + +*<_industrycat_isic_year_> + gen industrycat_isic_year="" + replace industrycat_isic_year="" if industrycat_isic_year=="." + replace industrycat_isic_year="" if q33!=1 + label var industrycat_isic_year "ISIC code of primary job 12 month recall" +* + + +*<_industrycat10_year_> + gen byte industrycat10_year=. + replace industrycat10_year=. if q33!=1 + label var industrycat10_year "1 digit industry classification, primary job 12 month recall" + la de lblindustrycat10_year 1 "Agriculture" 2 "Mining" 3 "Manufacturing" 4 "Public utilities" 5 "Construction" 6 "Commerce" 7 "Transport and Comnunications" 8 "Financial and Business Services" 9 "Public Administration" 10 "Other Services, Unspecified" + label values industrycat10_year lblindustrycat10_year +* + + +*<_industrycat4_year_> + gen byte industrycat4_year=industrycat10_year + recode industrycat4_year (1=1)(2 3 4 5 =2)(6 7 8 9=3)(10=4) + label var industrycat4_year "1 digit industry classification (Broad Economic Activities), primary job 12 month recall" + la de lblindustrycat4_year 1 "Agriculture" 2 "Industry" 3 "Services" 4 "Other" + label values industrycat4_year lblindustrycat4_year +* + + +*<_occup_orig_year_> + gen occup_orig_year=. + replace occup_orig_year=. if q33!=1 + label var occup_orig_year "Original occupation record primary job 12 month recall" +* + + +*<_occup_isco_year_> + gen str4 occup_isco_year="" + replace occup_isco_year="" if q33!=1|occup_isco_year=="." + label var occup_isco_year "ISCO code of primary job 12 month recall" +* + + +*<_occup_skill_year_> + gen skill_level_year=substr(occup_isco_year,1,1) + destring skill_level_year, replace + gen occup_skill_year=. + replace occup_skill_year=1 if skill_level_year==9 + replace occup_skill_year=2 if inrange(skill_level_year,4,8) + replace occup_skill_year=3 if inrange(skill_level_year,1,3) + replace occup_skill_year=. if skill_level_year==0|q33!=1 + label var occup_skill_year "Skill based on ISCO standard primary job 12 month recall" +* + + +*<_occup_year_> + gen byte occup_year=. + replace occup_year=. if q33!=1 + label var occup_year "1 digit occupational classification, primary job 12 month recall" + la de lbloccup_year 1 "Managers" 2 "Professionals" 3 "Technicians" 4 "Clerks" 5 "Service and market sales workers" 6 "Skilled agricultural" 7 "Craft workers" 8 "Machine operators" 9 "Elementary occupations" 10 "Armed forces" 99 "Others" + label values occup_year lbloccup_year +* + + +*<_wage_no_compen_year_> + gen double wage_no_compen_year=. + replace wage_no_compen_year=. if q33!=1 + label var wage_no_compen_year "Last wage payment primary job 12 month recall" +* + + +*<_unitwage_year_> + gen byte unitwage_year=. + replace unitwage_year=. if q33!=1 + label var unitwage_year "Last wages' time unit primary job 12 month recall" + la de lblunitwage_year 1 "Daily" 2 "Weekly" 3 "Every two weeks" 4 "Bimonthly" 5 "Monthly" 6 "Trimester" 7 "Biannual" 8 "Annually" 9 "Hourly" 10 "Other" + label values unitwage_year lblunitwage_year +* + + +*<_whours_year_> + gen whours_year=. + label var whours_year "Hours of work in last week primary job 12 month recall" +* + + +*<_wmonths_year_> + gen wmonths_year=. + label var wmonths_year "Months of work in past 12 months primary job 12 month recall" +* + + +*<_wage_total_year_> + gen wage_total_year=. + label var wage_total_year "Annualized total wage primary job 12 month recall" +* + + +*<_contract_year_> + gen byte contract_year=. + replace contract_year=. if q33!=1 + label var contract_year "Employment has contract primary job 12 month recall" + la de lblcontract_year 0 "Without contract" 1 "With contract" + label values contract_year lblcontract_year +* + + +*<_healthins_year_> + gen byte healthins_year=. + replace healthins_year=. if q33!=1 + label var healthins_year "Employment has health insurance primary job 12 month recall" + la de lblhealthins_year 0 "Without health insurance" 1 "With health insurance" + label values healthins_year lblhealthins_year +* + + +*<_socialsec_year_> + gen byte socialsec_year=. + label var socialsec_year "Employment has social security insurance primary job 7 day recall" + la de lblsocialsec_year 1 "With social security" 0 "Without social secturity" + label values socialsec_year lblsocialsec_year +* + + +*<_union_year_> + gen byte union_year=. + label var union_year "Union membership at primary job 12 month recall" + la de lblunion_year 0 "Not union member" 1 "Union member" + label values union_year lblunion_year +* + + +*<_firmsize_l_year_> + gen byte firmsize_l_year=. + label var firmsize_l_year "Firm size (lower bracket) primary job 12 month recall" +* + + +*<_firmsize_u_year_> + gen byte firmsize_u_year=. + label var firmsize_u_year "Firm size (upper bracket) primary job 12 month recall" +* + +} + + +*----------8.8: 12 month reference secondary job------------------------------* + +{ + +*<_empstat_2_year_> + gen byte empstat_2_year=. + label var empstat_2_year "Employment status during past week secondary job 12 month recall" + label values empstat_2_year lblempstat_year +* + + +*<_ocusec_2_year_> + gen byte ocusec_2_year=. + label var ocusec_2_year "Sector of activity secondary job 12 day recall" + la de lblocusec_2_year 1 "Public Sector, Central Government, Army" 2 "Private, NGO" 3 "State owned" 4 "Public or State-owned, but cannot distinguish" + label values ocusec_2_year lblocusec_2_year +* + + + +*<_industry_orig_2_year_> + gen industry_orig_2_year=. + label var industry_orig_2_year "Original survey industry code, secondary job 12 month recall" +* + + + +*<_industrycat_isic_2_year_> + gen industrycat_isic_2_year=. + label var industrycat_isic_2_year "ISIC code of secondary job 12 month recall" +* + + +*<_industrycat10_2_year_> + gen byte industrycat10_2_year=. + label var industrycat10_2_year "1 digit industry classification, secondary job 12 month recall" + label values industrycat10_2_year lblindustrycat10_year +* + + +*<_industrycat4_2_year_> + gen byte industrycat4_2_year=industrycat10_2_year + recode industrycat4_2_year (1=1)(2 3 4 5 =2)(6 7 8 9=3)(10=4) + label var industrycat4_2_year "1 digit industry classification (Broad Economic Activities), secondary job 12 month recall" + label values industrycat4_2_year lblindustrycat4_year +* + + +*<_occup_orig_2_year_> + gen occup_orig_2_year=. + label var occup_orig_2_year "Original occupation record secondary job 12 month recall" +* + + +*<_occup_isco_2_year_> + gen occup_isco_2_year=. + label var occup_isco_2_year "ISCO code of secondary job 12 month recall" +* + + +*<_occup_skill_2_year_> + gen occup_skill_2_year=. + label var occup_skill_2_year "Skill based on ISCO standard secondary job 12 month recall" +* + + +*<_occup_2_year_> + gen byte occup_2_year=. + label var occup_2_year "1 digit occupational classification, secondary job 12 month recall" + label values occup_2_year lbloccup_year +* + + +*<_wage_no_compen_2_year_> + gen double wage_no_compen_2_year=. + label var wage_no_compen_2_year "Last wage payment secondary job 12 month recall" +* + + +*<_unitwage_2_year_> + gen byte unitwage_2_year=. + label var unitwage_2_year "Last wages' time unit secondary job 12 month recall" + label values unitwage_2_year lblunitwage_year +* + + +*<_whours_2_year_> + gen whours_2_year=. + label var whours_2_year "Hours of work in last week secondary job 12 month recall" +* + + +*<_wmonths_2_year_> + gen wmonths_2_year=. + label var wmonths_2_year "Months of work in past 12 months secondary job 12 month recall" +* + + +*<_wage_total_2_year_> + gen wage_total_2_year=. + label var wage_total_2_year "Annualized total wage secondary job 12 month recall" +* + + +*<_firmsize_l_2_year_> + gen byte firmsize_l_2_year=. + label var firmsize_l_2_year "Firm size (lower bracket) secondary job 12 month recall" +* + + +*<_firmsize_u_2_year_> + gen byte firmsize_u_2_year=. + label var firmsize_u_2_year "Firm size (upper bracket) secondary job 12 month recall" +* + +} + + +*----------8.9: 12 month reference additional jobs------------------------------* + + +*<_t_hours_others_year_> + gen t_hours_others_year=. + label var t_hours_others_year "Annualized hours worked in all but primary and secondary jobs 12 month recall" +* + + +*<_t_wage_nocompen_others_year_> + gen t_wage_nocompen_others_year=. + label var t_wage_nocompen_others_year "Annualized wage in all but primary & secondary jobs excl. bonuses, etc. 12 month recall)" +* + + +*<_t_wage_others_year_> + gen t_wage_others_year=. + label var t_wage_others_year "Annualized wage in all but primary and secondary jobs 12 month recall" +* + + +*----------8.10: 12 month total summary------------------------------* + + +*<_t_hours_total_year_> + gen t_hours_total_year=. + label var t_hours_total_year "Annualized hours worked in all jobs 12 month month recall" +* + + +*<_t_wage_nocompen_total_year_> + gen t_wage_nocompen_total_year=. + label var t_wage_nocompen_total_year "Annualized wage in all jobs excl. bonuses, etc. 12 month recall" +* + + +*<_t_wage_total_year_> + gen t_wage_total_year=. + label var t_wage_total_year "Annualized total wage for all jobs 12 month recall" +* + + +*----------8.11: Overall across reference periods------------------------------* + + +*<_njobs_> + gen njobs=. + replace njobs=1 if lstatus==1&q17!=1 + replace njobs=2 if lstatus==1&q17==1 + replace njobs=. if lstatus!=1 + label var njobs "Total number of jobs" +* + + +*<_t_hours_annual_> + gen t_hours_annual=. + label var t_hours_annual "Total hours worked in all jobs in the previous 12 months" +* + + +*<_linc_nc_> + gen linc_nc=. + label var linc_nc "Total annual wage income in all jobs, excl. bonuses, etc." +* + + +*<_laborincome_> + gen laborincome=. + label var laborincome "Total annual individual labor income in all jobs, incl. bonuses, etc." +* + + +*----------8.13: Labour cleanup------------------------------* + +{ +*<_% Correction min age_> + +** Drop info for cases under the age for which questions to be asked (do not need a variable for this) + local lab_var "minlaborage lstatus nlfreason unempldur_l unempldur_u empstat ocusec industry_orig industrycat_isic industrycat10 industrycat4 occup_orig occup_isco occup_skill occup wage_no_compen unitwage whours wmonths wage_total contract healthins socialsec union firmsize_l firmsize_u empstat_2 ocusec_2 industry_orig_2 industrycat_isic_2 industrycat10_2 industrycat4_2 occup_orig_2 occup_isco_2 occup_skill_2 occup_2 wage_no_compen_2 unitwage_2 whours_2 wmonths_2 wage_total_2 firmsize_l_2 firmsize_u_2 t_hours_others t_wage_nocompen_others t_wage_others t_hours_total t_wage_nocompen_total t_wage_total lstatus_year nlfreason_year unempldur_l_year unempldur_u_year empstat_year ocusec_year industry_orig_year industrycat_isic_year industrycat10_year industrycat4_year occup_orig_year occup_isco_year occup_skill_year occup_year unitwage_year whours_year wmonths_year wage_total_year contract_year healthins_year socialsec_year union_year firmsize_l_year firmsize_u_year empstat_2_year ocusec_2_year industry_orig_2_year industrycat_isic_2_year industrycat10_2_year industrycat4_2_year occup_orig_2_year occup_isco_2_year occup_skill_2_year occup_2_year wage_no_compen_2_year unitwage_2_year whours_2_year wmonths_2_year wage_total_2_year firmsize_l_2_year firmsize_u_2_year t_hours_others_year t_wage_nocompen_others_year t_wage_others_year t_hours_total_year t_wage_nocompen_total_year t_wage_total_year njobs t_hours_annual linc_nc laborincome" + + foreach v of local lab_var { + cap confirm numeric variable `v' + if _rc == 0 { // is indeed numeric + replace `v'=. if ( age < minlaborage & !missing(age) ) + } + else { // is not + replace `v'= "" if ( age < minlaborage & !missing(age) ) + } + + } + +* +} + + +/*%%============================================================================================= + 9: Final steps +==============================================================================================%%*/ + +quietly{ + +*<_% KEEP VARIABLES - ALL_> + + keep countrycode survname survey icls_v isced_version isco_version isic_version year vermast veralt harmonization int_year int_month hhid pid weight psu strata wave panel visit_no urban subnatid1 subnatid2 subnatid3 subnatidsurvey subnatid1_prev subnatid2_prev subnatid3_prev gaul_adm1_code gaul_adm2_code gaul_adm3_code hsize age male relationharm relationcs marital eye_dsablty hear_dsablty walk_dsablty conc_dsord slfcre_dsablty comm_dsablty migrated_mod_age migrated_ref_time migrated_binary migrated_years migrated_from_urban migrated_from_cat migrated_from_code migrated_from_country migrated_reason ed_mod_age school literacy educy educat7 educat5 educat4 educat_orig educat_isced vocational vocational_type vocational_length_l vocational_length_u vocational_field_orig vocational_financed minlaborage lstatus potential_lf underemployment nlfreason unempldur_l unempldur_u empstat ocusec industry_orig industrycat_isic industrycat10 industrycat4 occup_orig occup_isco occup_skill occup wage_no_compen unitwage whours wmonths wage_total contract healthins socialsec union firmsize_l firmsize_u empstat_2 ocusec_2 industry_orig_2 industrycat_isic_2 industrycat10_2 industrycat4_2 occup_orig_2 occup_isco_2 occup_skill_2 occup_2 wage_no_compen_2 unitwage_2 whours_2 wmonths_2 wage_total_2 firmsize_l_2 firmsize_u_2 t_hours_others t_wage_nocompen_others t_wage_others t_hours_total t_wage_nocompen_total t_wage_total lstatus_year potential_lf_year underemployment_year nlfreason_year unempldur_l_year unempldur_u_year empstat_year ocusec_year industry_orig_year industrycat_isic_year industrycat10_year industrycat4_year occup_orig_year occup_isco_year occup_skill_year occup_year wage_no_compen_year unitwage_year whours_year wmonths_year wage_total_year contract_year healthins_year socialsec_year union_year firmsize_l_year firmsize_u_year empstat_2_year ocusec_2_year industry_orig_2_year industrycat_isic_2_year industrycat10_2_year industrycat4_2_year occup_orig_2_year occup_isco_2_year occup_skill_2_year occup_2_year wage_no_compen_2_year unitwage_2_year whours_2_year wmonths_2_year wage_total_2_year firmsize_l_2_year firmsize_u_2_year t_hours_others_year t_wage_nocompen_others_year t_wage_others_year t_hours_total_year t_wage_nocompen_total_year t_wage_total_year njobs t_hours_annual linc_nc laborincome + +* + +*<_% ORDER VARIABLES_> + + order countrycode survname survey icls_v isced_version isco_version isic_version year vermast veralt harmonization int_year int_month hhid pid weight psu strata wave panel visit_no urban subnatid1 subnatid2 subnatid3 subnatidsurvey subnatid1_prev subnatid2_prev subnatid3_prev gaul_adm1_code gaul_adm2_code gaul_adm3_code hsize age male relationharm relationcs marital eye_dsablty hear_dsablty walk_dsablty conc_dsord slfcre_dsablty comm_dsablty migrated_mod_age migrated_ref_time migrated_binary migrated_years migrated_from_urban migrated_from_cat migrated_from_code migrated_from_country migrated_reason ed_mod_age school literacy educy educat7 educat5 educat4 educat_orig educat_isced vocational vocational_type vocational_length_l vocational_length_u vocational_field_orig vocational_financed minlaborage lstatus potential_lf underemployment nlfreason unempldur_l unempldur_u empstat ocusec industry_orig industrycat_isic industrycat10 industrycat4 occup_orig occup_isco occup_skill occup wage_no_compen unitwage whours wmonths wage_total contract healthins socialsec union firmsize_l firmsize_u empstat_2 ocusec_2 industry_orig_2 industrycat_isic_2 industrycat10_2 industrycat4_2 occup_orig_2 occup_isco_2 occup_skill_2 occup_2 wage_no_compen_2 unitwage_2 whours_2 wmonths_2 wage_total_2 firmsize_l_2 firmsize_u_2 t_hours_others t_wage_nocompen_others t_wage_others t_hours_total t_wage_nocompen_total t_wage_total lstatus_year potential_lf_year underemployment_year nlfreason_year unempldur_l_year unempldur_u_year empstat_year ocusec_year industry_orig_year industrycat_isic_year industrycat10_year industrycat4_year occup_orig_year occup_isco_year occup_skill_year occup_year wage_no_compen_year unitwage_year whours_year wmonths_year wage_total_year contract_year healthins_year socialsec_year union_year firmsize_l_year firmsize_u_year empstat_2_year ocusec_2_year industry_orig_2_year industrycat_isic_2_year industrycat10_2_year industrycat4_2_year occup_orig_2_year occup_isco_2_year occup_skill_2_year occup_2_year wage_no_compen_2_year unitwage_2_year whours_2_year wmonths_2_year wage_total_2_year firmsize_l_2_year firmsize_u_2_year t_hours_others_year t_wage_nocompen_others_year t_wage_others_year t_hours_total_year t_wage_nocompen_total_year t_wage_total_year njobs t_hours_annual linc_nc laborincome + +* + +*<_% DROP UNUSED LABELS_> + + * Store all labels in data + label dir + local all_lab `r(names)' + + * Store all variables with a label, extract value label names + local used_lab = "" + ds, has(vallabel) + + local labelled_vars `r(varlist)' + + foreach varName of local labelled_vars { + local y : value label `varName' + local used_lab `"`used_lab' `y'"' + } + + * Compare lists, `notused' is list of labels in directory but not used in final variables + local notused : list all_lab - used_lab // local `notused' defines value labs not in remaining vars + local notused_len : list sizeof notused // store size of local + + * drop labels if the length of the notused vector is 1 or greater, otherwise nothing to drop + if `notused_len' >= 1 { + label drop `notused' + } + else { + di "There are no unused labels to drop. No value labels dropped." + } + + +* + +} + +*<_% DELETE MISSING VARIABLES_> + +quietly: describe, varlist +local kept_vars `r(varlist)' + +foreach var of local kept_vars { + capture assert missing(`var') + if !_rc drop `var' +} + +* + + +*<_% COMPRESS_> + +compress + +* + + +*<_% SAVE_> + +save "`path_output'/`level_2_harm'_ALL.dta", replace + +*