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 on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: extract string portion


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: extract string portion
Date   Tue, 27 Nov 2012 06:22:34 -0600

Another option would be to use -split-

drop _all
input str63 company
"OnlineChoice.com, Inc. (Exelon Corporation (NYSE:EXC))"
"Peppers & Rogers Group (TeleTech Holdings Inc. (NasdaqGS:TTEC))"
end

split company, gen(company) p("(")
split company3, gen(ticker) p(":")
replace ticker2 = subinstr(ticker2, "))", "",.)
drop company3
list

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index