Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: New version of -sencode- on SSC

From   Roger Newson <>
Subject   st: New version of -sencode- on SSC
Date   Sun, 22 Jun 2003 16:13:08 +0100

Fellow Statalisters

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


sencode: Encode a string variable non-alphanumerically into a numeric variable

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

Author: Roger Newson
Distribution-Date: 20june2003
Stata-Version: 7

INSTALLATION FILES (click here to install)

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

Opinions expressed are those of the author, not the institution.

* For searches and help try:

© Copyright 1996–2019 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index