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: Parsing words on allcaps


From   Matthew Kerby <kerbym@mun.ca>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Parsing words on allcaps
Date   Sat, 17 Mar 2012 08:58:12 -0230

Thanks! Worked.


On 2012-03-17, at 8:08 AM, Nick Cox wrote:

> -moss- (SSC) should help.
> 
> Nick
> 
> On 17 Mar 2012, at 09:53, Matthew Kerby <kerbym@mun.ca> wrote:
> 
>> Dear Statalist
>> 
>> Perhaps somebody can advise on how to solve this problem.
>> 
>> I have a dataset which consists of a single string variable. The each observation consists of a sentence which in turn contains a name in all caps. I would like to create a new variable which contains only those words which appear in all caps. eg. in example below I would like to extract the name of the hockey player.
>> 
>> 
>> clear
>> input str244 string
>> "GRETZKY W. likes hamburgers"
>> "Hotdogs are preferred by LEMIEUX M."
>> "All things being equal, CROSBY S. will eat doughnuts"
>> end
>> 
>> I would like to end up with a string variable (player) which looks like the following:
>> 
>> player
>> "GRETZKY W."
>> "LEMIEUX M."
>> "CROSBY S."
>> 
>> Any help on how to parse a string variable on allcaps is greatly appreciated.
>> Cheers,
>> M
> *
> *   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/


This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2011.php

*
*   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