Thanks to Kit Baum, there is now a new version of -sencode- downloadable
from SSC. In Stata, type -ssc desc sencode- to find out more.
-sencode- ("sequential -encode-") is a version of -encode- which encodes a
string variable to numeric in sequential order of appearance in the data
set, rather than alphanumerically. The new version still does this by
default, but has a -gsort- option, so that the encoding can be done in any
order specifiable to -gsort-. The mapping of numeric code values to string
values may be one-to-one, so that each string value has a single numeric
code, or many-to-one, so that each string value may have multiple numeric
codes, corresponding to multiple appearances of the string value in the
data set. -sencode- may be useful when the input string variable is used as
a source of axis labels in a Stata graph and the output numeric variable is
used as the X-variable or Y-variable.
Best wishes
Roger
--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom
Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Opinions expressed are those of the author, not the institution.