Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: middle initial


From   Nick Sanders <sandersn@stanford.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: middle initial
Date   Wed, 28 Dec 2011 14:23:36 -0600

Hi Mike,

Try the substring command:

gen midinitial = susbstring(middlename,1,1)

That should do it!

Best,
Nick



On Dec 28, 2011, at 2:12 PM, Michael Eisenberg <meisenberg713@gmail.com> wrote:

> Colleagues,
> 
> I have what I hope will be a simple question to answer.
> 
> I have a list of middle names and I'd like to isolate the first initial.
> 
> I tried but it gives me the letter with ... after it.
> 
> gen midi=middlename
> format midi %1s
> 
> Thank you in advance.
> 
> Mike
> *
> *   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index