Stata String To Float. The first tabulate looks identical to the tabulate done on the string variable region above. The first line of syntax reads in the dataset shown above.
Convert variables from string to numeric in stataearnings management data. See also the dpcomma option below. Sometimes for whatever reason stata incorrectly calls a categorical variable a string variable.
Encode cntry gen cntrynum will convert cntry to a numeric variable with the characters from the former string variable as value labels.
If for some reason you want to convert a numeric variable into a string variable you may use the complementary function decode. If for example you had a gender variable consisting of ones and zeroes that encoded as str1 and was therefore all numbers you could use the destring command. If for some reason you want to convert a numeric variable into a string variable you may use the complementary function decode. As you can see from the second tabulate region2 has the numeric values 1 through 4 but retains the strings central east south and west as value labels.