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

st: how to keep only the first letter of a string type variable


From   sarah smith <sarah22209@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: how to keep only the first letter of a string type variable
Date   Fri, 15 Oct 2004 18:49:58 -0400

Hi,
 
I have a variable of string type and I only want to keep the first
letter in each observation. I tried to use "abbrev" function as below:

gen str11  newcountry = abbrev( country,1)

but it didn't work. Could you help me please? and thanks a lot David
for your reply about missing data!

Sarah
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index