Dear readers,
thanks for your answer. It helped a lot.
2012/12/9 Ryan Kessler <ryan.kessler.stata@gmail.com>:
> Something like this should do the trick:
>
> input str30 clip
> "String string Canada"
> "Canadian String string"
> "String Canada string"
> end
>
> gen canada = (strmatch(lower(clip), "*canada*") |
> strmatch(lower(clip), "*canadian*"))
> list clip canada
>
> Best,
>
> Ryan
>
> On Sat, Dec 8, 2012 at 8:34 PM, Donald Spady <dspady@ualberta.ca> wrote:
>> try
>> help strpos
>>
>> Don
>> On 2012-12-08, at 4:23 PM, thomas bourveau <thomas.bourveau@gmail.com> wrote:
>>
>>> Dear readers,
>>>
>>> you recently helped me to extract a firm's identifier that was located
>>> at the end of a string variable.
>>>
>>> I'm still working with this dataset of layoff announcements.
>>>
>>> Now, I need to know to which country an annoucement is related.
>>> To do this, I need to identify if a portion of string (namely the name
>>> of a country) appears at any position in the string.
>>>
>>> Specifically, I have a summary (10 to 20 words) of a newspaper article.
>>> This is a string variable.
>>>
>>> For each country of the dataset, I created a variable equals to 0.
>>>
>>> For example, I have a variable called Canada = 0
>>>
>>> I want to replace this variable by 1 if the word Canada or Canadian
>>> appears anywhere in my string variable.
>>>
>>> Does anyone have any idea on that.
>>>
>>> Thanks in advance
>>> Thomas
>>>
>>> --
>>> Thomas Bourveau
>>> thomas.bourveau@gmail.com
>>> 0637573925
>>> *
>>> * For searches and help try:
>>> * http://www.stata.com/help.cgi?search
>>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>>> * http://www.ats.ucla.edu/stat/stata/
>>>
>>
>> Donald Spady
>>
>> --
>> dspady@ualberta.ca
>>
>>
>>
>>
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
--
Thomas Bourveau
thomas.bourveau@gmail.com
0637573925
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/