[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str4 fileid str2 quarter float hhtype byte sector
"FVH1" "Q5" 2 1
"FVH1" "Q5" 2 1
"FVH1" "Q5" 2 1
"FVH1" "Q5" 2 2
"FVH1" "Q5" 2 1
"FVH1" "Q5" 1 1
"FVH1" "Q5" 1 2
"FVH1" "Q5" 1 1
"FVH1" "Q5" 3 2
"FVH1" "Q5" 1 1
"FVH1" "Q5" 3 1
"FVH1" "Q5" 2 1
"FVH1" "Q6" 5 1
"FVH1" "Q6" 1 1
Given this data, I want to define labels for HHTYPE based on the different values for sector. For example, HHTYPE==1 should be labelled as "agriculture" when sector==1 but "factory" when sector==2. However, I am unable to use label define with if conditions. Any advice is greatly appreciated.
* Example generated by -dataex-. To install: ssc install dataex
clear
input str4 fileid str2 quarter float hhtype byte sector
"FVH1" "Q5" 2 1
"FVH1" "Q5" 2 1
"FVH1" "Q5" 2 1
"FVH1" "Q5" 2 2
"FVH1" "Q5" 2 1
"FVH1" "Q5" 1 1
"FVH1" "Q5" 1 2
"FVH1" "Q5" 1 1
"FVH1" "Q5" 3 2
"FVH1" "Q5" 1 1
"FVH1" "Q5" 3 1
"FVH1" "Q5" 2 1
"FVH1" "Q6" 5 1
"FVH1" "Q6" 1 1
Given this data, I want to define labels for HHTYPE based on the different values for sector. For example, HHTYPE==1 should be labelled as "agriculture" when sector==1 but "factory" when sector==2. However, I am unable to use label define with if conditions. Any advice is greatly appreciated.
Comment