SLIDE 22 String variables
Load pdmv_sl.dta and des the data. In the column ‘storage type’ you will see the data type of each variable. Variables come in different shapes or forms, the major distinction is between numeric and string data variables. String variables
◮ Can hold up to 244 characters in length, 1 byte per character. ◮ Typically ordinal information is stored as strings (e.g., names, job or industry
classifications, addresses, etc.)
◮ It may make sense to convert string to numeric variables, the commands
destring (converting numbers stored as strings to numeric variables), and encode (creating a new variable which attaches numbers to every realization of
a string variable) may prove useful.
◮ For a finite and small number of realizations, also tab, gen(varname ) is
possible to convert from string to numeric.
Alexander Ahammer (JKU) Module A: Elementary concepts and data organization 22 / 57