Code:
gen byte animal1=(a34animal1==1|a34animal_2==1|a34animal_3==1|a34animal4==1|a34animal_5==1|a34animal_6==1|a34animal_7==1)
Code:
list a34animal1 a34animal_2 a34animal_3 a34animal4 a34animal_5 a34animal_6 a34animal_7 animal1 in 6637/6646 +--------------------------------------------------------------------------------------+ | a34an~l1 a34ani~2 a34ani~3 a34an~l4 a34ani~5 a34ani~6 a34ani~7 animal1 | |--------------------------------------------------------------------------------------| 6637. | 0 0 0 1 0 0 0 1 | 6638. | 6 0 0 1 0 0 0 1 | 6639. | 1 0 0 1 0 0 0 1 | 6640. | 6 0 0 1 0 0 0 1 | 6641. | 1 0 0 1 0 0 0 1 | |--------------------------------------------------------------------------------------| 6642. | 6 0 0 1 0 0 0 1 | 6643. | 6 0 0 1 0 0 0 1 | 6644. | 0 0 0 1 0 0 0 1 | 6645. | 1 6 0 1 0 0 0 1 | 6646. | 4 6 0 1 0 0 0 1 | +--------------------------------------------------------------------------------------+
Knowing that the excel file and the data editor both show data similar to as above but different from the dataex in terms of a34animal1 and a34animal4.
These particular variables were originally string variables (because they have some characters) but I encoded them. The issue would probably be because of this but I still can't pinpoint it yet. I wish I can get the original values in my encoded variables but don't know how.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long a34animal1 byte(a34animal_2 a34animal_3) long a34animal4 byte(a34animal_5 a34animal_6 a34animal_7 animal1) 1 0 0 1 0 0 0 1 11 0 0 1 0 0 0 1 2 0 0 1 0 0 0 1 11 0 0 1 0 0 0 1 2 0 0 1 0 0 0 1 11 0 0 1 0 0 0 1 11 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 2 6 0 1 0 0 0 1 9 6 0 1 0 0 0 1 end label values a34animal1 a34animal1 label def a34animal1 1 "0", modify label def a34animal1 2 "1", modify label def a34animal1 9 "4", modify label def a34animal1 11 "6", modify label values a34animal4 a34animal4 label def a34animal4 1 "0", modify
0 Response to Label values
Post a Comment