As far as I understand string variables cannot have value labels. However, I have received a dataset with string variables which shows (output of -describe- command) that the string variables have value labels attached to them. Moreover, the value labels have two or more different labels (texts) attached to the same value 0 (while the variables have no zero values). Could anyone share any thought about what might be going on here? Or have any of you encountered this problem ever? I am sharing my code and its output below (I cannot even understand how to give a data example in this context as I do not know how to create string variables with value labels, so pardon me.) Note that the problem remains the same even if I save the data in the newer dta format 118.
Code:
. use "D:\L02_Demographic_particulars.dta"
. version
version 19.5
. dtaversion "D:\L02_Demographic_particulars.dta"
(file "D:\L02_Demographic_particulars.dta" is .dta-format 115 from Stata 12)
. describe Sector Gender
Variable Storage Display Value
name type format label Variable label
--------------------------------------------------------------------------------
Sector str1 %-9s Sector0 Sector
Gender str1 %-9s Gender2 Gender
. label list Sector0 Gender2
Sector0:
0 urban
0 rural
Gender2:
0 Female
0 transgender
0 Male
. tab Sector
Sector | Freq. Percent Cum.
------------+-----------------------------------
1 | 292,208 62.63 62.63
2 | 174,319 37.37 100.00
------------+-----------------------------------
Total | 466,527 100.00
. tab Gender
Gender | Freq. Percent Cum.
------------+-----------------------------------
1 | 240,556 51.56 51.56
2 | 225,897 48.42 99.98
3 | 74 0.02 100.00
------------+-----------------------------------
Total | 466,527 100.00

Comment