Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
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/