Hi,
I am having trouble coding these variables into two categories: edible foods and non-edible foods. I am not sure if the coding is the same way as continuous variables? I am relatively new to STATA, any advice is greatly appreciated!
Here are my codes:
tab Crop_name, mi nol
encode Crop_name, gen(Crop_namecodes)
tab Crop_namecodes, miss
gen Crop_namecodescat = Crop_namecodes
recode Crop_namecodescat bananafood beans maize =1 coffee cocao =2
label define Crop_namecodescatlab 1 "edible food" 2 "non-edible food"
------------------ copy up to and including the previous line ------------------
Listed 100 out of 15403 observations
Use the count() option to list more
I am having trouble coding these variables into two categories: edible foods and non-edible foods. I am not sure if the coding is the same way as continuous variables? I am relatively new to STATA, any advice is greatly appreciated!
Here are my codes:
tab Crop_name, mi nol
encode Crop_name, gen(Crop_namecodes)
tab Crop_namecodes, miss
gen Crop_namecodescat = Crop_namecodes
recode Crop_namecodescat bananafood beans maize =1 coffee cocao =2
label define Crop_namecodescatlab 1 "edible food" 2 "non-edible food"
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str20 Crop_name "" "Banana food" "Cassava" "Beans" "Dodo" "Dodo" "Maize" "Yam" "Banana food" "Beans" "Maize" "Banana food" "Beans" "Maize" "Coffee all" "" "Banana food" "Banana food" "Banana food" "Cassava" "Banana food" "Coffee all" "Beans" "Maize" "Groundnuts" "Maize" "Cassava" "Maize" "Sweet potatoes" "" "Beans" "" "Cocoa" "Coffee all" "Groundnuts" "Groundnuts" "Beans" "Cassava" "" "Sweet potatoes" "Banana food" "Cassava" "Maize" "Yam" "Sugarcane" "" "Banana food" "Beans" "Beans" "Cassava" "Maize" "Banana food" "" "Banana food" "Coffee all" "Sweet potatoes" "Cassava" "Yam" "Groundnuts" "Maize" "Sweet potatoes" "Maize" "Maize" "Beans" "Maize" "" "Banana food" "Maize" "Beans" "Cassava" "Banana food" "Beans" "Coffee all" "Fallow" "Sweet potatoes" "Beans" "Cassava" "Maize" "Banana food" "" "Fallow" "Banana food" "Coffee all" "Banana beer" "Sweet potatoes" "Maize" "Beans" "Maize" "Banana food" "Coffee all" "Banana food" "Beans" "Cassava" "Maize" "" "" "" "" "Banana beer" "Banana beer" end
Listed 100 out of 15403 observations
Use the count() option to list more
Comment