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

RE: st: recoding strings variables to numerical


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   RE: st: recoding strings variables to numerical
Date   Mon, 20 Jun 2005 09:18:17 +0200

bw wants to recode the strings  'high', 'low', 'medium', 
'vhigh', etc to numerical values e.g. high = 1, low=2.

I guess a better choice for these four categories would be:
1 low; 2 medium; 3 high; 4 vhigh

To get that, use encode withe the label option:

. label define aaalabel 1 "low" 2 "medium" 3 "high" 4 "vhigh"
. encode aaastr , generate(aaa) label(aaalabel)

Hope this helps
Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: [email protected]
__________________________________________ 

*
*   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/



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