Ashim,
You can use the string functions, see -help string functions- to extract the information that you want. For instance
generate place = word(cname, -1)
will return the last word in the variable cname. Similarly,
generate place = word(cname, 2)
will return the second word (although this may not be what you want as there is only one word in your first example).
-- Matt
[email protected]
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Ashim Kapoor
Sent: Tuesday, 23 September 2008 3:07 PM
To: [email protected]
Subject: st: trimming leading numbers from a string.
Hello everyone,
I have a string variable called "cname".
It looks something like this.
cname
1. DELHI
2. 0 HYDERBAD
3. 1 USA
4. 4 AP
I want to remove the leading 0 / 1 / 4 / other numbers from this
string and keep only the alphabets. Is there a do file someone has
written on this ?
Thank you,
Ashim.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/