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

RE: st: Converting letters to numbers


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   RE: st: Converting letters to numbers
Date   Wed, 28 Jan 2004 21:44:40 -0000 (GMT)

Nick Cox wrote:

> Joseph Coveney suggested -encode- after
> -label define- while Michael Blasnik
> pointed to the -subinstr()- function.
>
> Another solution is not needed therefore,
> but there is in -egenmore- on SSC a
> user-written -egen- function, -ston()-
> (think _s_tring to _n_umeric) which offers
> an alternative. Using that we have, say,
>
> foreach v of var party? {
> 	egen `v'n = ston(`v'), from(c d l n) to(1/4)
> }
>
> -ston()- has a twin -ntos()- to do the inverse.

Thanks for this.

C.

CLIVE NICHOLAS        |t: 0(44)191 222 5969
Politics Building     |e: [email protected]
School of Geography,  |f: 0(44)870 126 2421
 Politics & Sociology |
University of         |
 Newcastle-upon-Tyne  |
Newcastle-upon-Tyne   |
NE1 7RU		      |
United Kingdom	      |http://www.ncl.ac.uk/geps
*
*   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