Try also the egen-function "ends". Using that you can split a string into parts,
specifying the partitioner.
Jesper
"Terra Curtis"
<terra.curtis@c
ambridgefinance To
.com> <[email protected]>
Sent by: cc
owner-statalist
@hsphsun2.harva Subject
rd.edu st: String help
10/04/2005
10:37 PM
Please respond
to
statalist@hsphs
un2.harvard.edu
Dear statalisters,
I am dealing with a string variable called 'string' like the example below
(this is copied from the data browser):
string
ABBOTT DIA 40410 CHLAMYDIA TSPK PAGES
COST
40410 CHLAMYDIAZYME PAGES
COST
78920 INSTITUTIONAL PAGES
COST
80000 VISION BL ANALYSER PAGES
COST
COMPANY TOTAL PAGES
COST
ABBOTT HPD 04200 AMIDATE PAGES
COST
60700 AMINOSYN PAGES
COST
53192 AMINOSYN II PAGES
COST
76340 CALCIJEX PAGES
COST
78920 INSTITUTIONAL PAGES
COST
78920 MULTIPLE PRODUCTS PAGES
COST
COMPANY TOTAL PAGES
COST
I want to split this up a certain way. In some of the observations, a
company name comes first, always the words directly before any number in the
string. So first I want to split the string just at the company name (and
words before any numbers). Then, I want to split it after the 5 numbers.
Lastly, I want to split it after the 5 numbers and before the word "PAGES."
When I am done, I want to have -- new variables, one with company name, one
with drug number (the 5 numbers), on with drug name (words following the
numbers, except "PAGES"), and one with either "PAGES" or "COST" according to
what is the last word in 'string.' I guess this a lot of questions in one,
but does anyone see an easy way to do this? I'm new to working with string
variables.
Thanks a lot.
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/