Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Roger B. Newson" <r.newson@imperial.ac.uk> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: New versions of -sencode- and -sdecode- on SSC |
Date | Mon, 23 Sep 2013 12:22:37 +0100 |
The -sencode- and -sdecode- packages are described as below on my website. The new versions are still in Stata Versions 10 and 11, respectively. However, the online help for both packages now contains hypertext to my presentation at the 2013 Stata User Meeting on -sencode- and -sdecode- (Newson, 2013), which contains some useful tips about the use of -sencode- and -sdecode- together.
Best wishes Roger ReferencesNewson, R. B. 2013. Creating factor variables in resultssets and other datasets. Presented at the 19th United Kingdom Stata Users' Group Meeting, 12–13 September, 2013. Download from
http://ideas.repec.org/p/boc/usug13/01.html -- Roger B Newson BSc MSc DPhil Lecturer in Medical Statistics Respiratory Epidemiology and Public Health Group National Heart and Lung Institute Imperial College London Royal Brompton Campus Room 33, Emmanuel Kaye Building 1B Manresa Road London SW3 6LR UNITED KINGDOM Tel: +44 (0)20 7352 8121 ext 3381 Fax: +44 (0)20 7351 8322 Email: r.newson@imperial.ac.uk Web page: http://www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ Opinions expressed are those of the author, not of the institution. ------------------------------------------------------------------------------------- package sencode from http://www.imperial.ac.uk/nhli/r.newson/stata10 ------------------------------------------------------------------------------------- TITLEsencode: 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 eachobservation by the position of that observation in the data set, or in the
user-specified ordering). Author: Roger Newson Distribution-Date: 20september2013 Stata-Version: 10 INSTALLATION FILES (click here to install) sencode.ado sencode.sthlp ------------------------------------------------------------------------------------- (click here to return to the previous screen) ------------------------------------------------------------------------------------- TITLEsdecode: Decode a numeric variable to string, formatting unlabelled values
DESCRIPTION/AUTHOR(S) sdecode ("super decode") creates an output string variable with values from the input numeric variable varname, using labels if present and formats otherwise. The output string variable may either replace the input numeric variable or be generated as a new variable named newvar. Unlike decode, sdecode creates an output string variable containing the values of the input variable as output by the tabulate command and other Stata output, instead of decoding all unlabelled input values to missing. sdecode is especially useful if a numeric variable has value labels for some values but not for others. msdecode is a multivariate version of sdecode, which inputs a list of numeric or string variables and (optionally) a list of delimiters, and creates a single string variable, containing the concatenated values of all the input variables, decoded if necessary and separated by the delimiters if provided. Author: Roger Newson Distribution-Date: 20september2013 Stata-Version: 11.0 INSTALLATION FILES (click here to install) sdecode.ado sdecode.sthlp msdecode.ado msdecode.sthlp ------------------------------------------------------------------------------------- (click here to return to the previous screen) * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/