| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: encoding unique letter into a unique number for combinedcombinations
From |
Jeph Herrin <[email protected]> |
To |
[email protected] |
Subject |
Re: st: encoding unique letter into a unique number for combinedcombinations |
Date |
Wed, 14 Feb 2007 10:53:46 -0500 |
If your example is strictly true (you have all
uppercase letters, you want to map A->1,..., Z->26),
then:
forv i=1/26 {
replace myvar = subinstr(myvar,char(`i'+64),string(`i',%02.0f),.)
}
hth,
Jeph
T.J. Volant wrote:
Hello all,
My apologies if this questions seems primitive. How
can I program so that it will encode each unique
letter into a unique number? Example:
I got hundreds of combinations of strings like:
ABC
ABB
ACA
Then, encode only gives me 1,2,3 in order. But I would
like to label letter A=01, B=02, C=01 etc, and then
have encode give me 010203, etc. How can I program
this?
Thank you very much,
Tj
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
*
* 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/
*
* 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/