Thanks to Kit Baum, there is now a new version of the -sencode- package
downloadable from SSC. Type -ssc desc sencode- to find out more.
The -sencode- package is as described below on my website. The new version
not only preserves the original sorting order of the data (as the old
version did), but also preserves the result of the -sortedby- extended
macro function. This is because the new version uses -sortpreserve-. I
would like to thank Nick Cox and Patrick Joly, who both suggested this
improvement to me.
Best wishes
Roger
TITLE
sencode: Encode a string variable non-alphanumerically into a
numeric variable
DESCRIPTION/AUTHOR(S)
sencode is a sequential version of encode. It takes, as input, a string
variable, and generates, as output, a numeric variable, with value
labels
corresponding to values of the string variable. Unlike encode, sencode
orders the numeric values corresponding to string values in the
sequential
order of appearance in the input string variable in the data set, or in
another order specified by the user, instead of ordering them in
alphanumeric
order of the string value, as encode does. The mapping from numeric code
values to string labels may be one-to-one (coded in order of first
appearance of the string value) or many-to-one (coded in each
observation
by the position of that observation in the data set, or in the
user-specified
ordering).
Author: Roger Newson
Distribution-Date: 20june2003
Stata-Version: 7
INSTALLATION FILES (click here to install)
sencode.ado
sencode.hlp
--
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]
Website: http://www.kcl-phs.org.uk/rogernewson
Opinions expressed are those of the author, not the institution.