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]

st: regexm


From   KOTa <kota.alba@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: regexm
Date   Sat, 27 Aug 2011 01:59:58 +0200

Dear statalisters,

I am trying to extract some data from text variable and being new to
stata programming struggling with finding right format.

my problem is as following:

for example i have string variable as following: "A: 0.35%-$100(M)
0.30%-$300(M) 0.27% th_aft."

number of pairs "% - (M)" can be from 1 to 9 and it always ends by "% th_aft"

I have 10 pairs of variables X1 Y1 .... X10 Y10

my goal is to extract all pairs from the string variable and split
them into my separate variables.

in this case the result should be:

X1  = 0.35%
Y1 = $100

X2 = 0.30%
Y2 = $300

X3-X9 = y3-Y9 = 0

X10 = 0.27%
Y10 = Y2 (i.e. last Y extracted from sting)

I am trying to use regexm but unsuccessfully, Any suggestions?


thank you in advance

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