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

st: RE: Re: breaking strings


From   "Dev Vencappa" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: breaking strings
Date   Thu, 29 Sep 2005 16:16:08 +0100

>>
After you have split the string into words, how about using strpos to find out where the position of the character "," or "." is and then use substring to retreive the words you need? Can you try that?

Dev

>>> [email protected] 09/29/05 3:59 pm >>>
Thanks, split seems to do the job.  However now I have some special cases to
deal with.  Say I have a company name like: 
Medical Research, Inc.  

I want to split this into 
Medical 
Research 
Inc
So that the "," and the "." are dropped.  I've tried combining -split- with
the -ignore- option, but it doesn't seem to be doing anything as the comma
and period remain in the split variables.  Anyone know how to take care of
this?

Thanks,
Terra
 

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Michael Blasnik
Sent: Wednesday, September 28, 2005 5:16 PM
To: [email protected] 
Subject: st: Re: breaking strings

help split

----- Original Message -----
From: "Terra Curtis" <[email protected]>
To: <[email protected]>
Sent: Wednesday, September 28, 2005 5:08 PM
Subject: st: breaking strings


> Dear Statalist,
>
> I am trying to find a string function (or equivalent series of code lines)
> to accomplish the following.  I have a string variable which contains
> various company names, eli lilly & co, for example.  I want to break this
> string into 4 separate data points, namely eli, lilly, &, co.  The 
> delimeter
> is a space.  Anyone know how to do this?
>
> Thanks,
> Terra
>
> *
> *   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/ 

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


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


This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


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