Thanks to Kit Baum, new versions of the -sencode- and -sdecode-
(described as below on my website) are now available for download from
SSC. In Stata, use the -ssc- command to do this.
-sencode- and -sdecode- are super versions of -encode- and -decode-,
respectively. The new versions both contain my new affiliation and email
in the on-line help files. The new -sdecode- also adds the new options
-prefix()- and -suffix()-, specifying strings to be added to the left or
right (respectively) of the decoded string variable.
Roger
Roger Newson
Lecturer in Medical Statistics
POSTAL ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
St Mary's Campus
Norfolk Place
London W2 1PG
STREET ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
47 Praed Street
Paddington
London W1 1NR
TELEPHONE: (+44) 020 7594 0939
FAX: (+44) 020 7594 0942
EMAIL: [email protected]
WEBSITE: http://www.imperial.ac.uk/nhli/r.newson/
Opinions expressed are those of the author, not of the institution.
------------------------------------------------------------------------
------------
package sencode from http://www.imperial.ac.uk/nhli/r.newson/stata7
------------------------------------------------------------------------
------------
TITLE
sencode: Encode a string variable non-alphanumerically into a
numeric variable
DESCRIPTION/AUTHOR(S)
sencode is an extended 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. The output numeric
variable
may replace the input string variable or be generated as a new
variable.
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: 27march2006
Stata-Version: 7
INSTALLATION FILES (click here to
install)
sencode.ado
sencode.hlp
------------------------------------------------------------------------
------------
(click here to return to the previous screen)
------------------------------------------------------------------------
------------
package sdecode from http://www.imperial.ac.uk/nhli/r.newson/stata7
------------------------------------------------------------------------
------------
TITLE
sdecode: Decode a numeric variable to string, formatting
unlabelled values
DESCRIPTION/AUTHOR(S)
sdecode is an extended version of decode. It takes, as input, a
numeric
variable, and generates, as output, a string variable, with values
corresponding to value labels of the numeric variable for labelled
values,
and (optionally) formatted values of the numeric variable for
unlabelled
values. The output string values therefore appear as the numeric
input
values appear in output from the tabulate command. The output
string
variable may replace the input numeric variable or be generated as
a new
variable.
Author: Roger Newson
Distribution-Date: 27march2006
Stata-Version: 7
INSTALLATION FILES (click here to
install)
sdecode.ado
sdecode.hlp
------------------------------------------------------------------------
------------
(click here to return to the previous screen)
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/