Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: loop until "0 real changes made"
From
Haluk Vahaboglu <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: loop until "0 real changes made"
Date
Mon, 29 Jul 2013 13:48:01 +0000
Hello everybody,
I would like to ask a simple question (probably a simple question).
I am using Stata 12.1 for Linux-64 bit and dealing with Turkish characters in string variables. I convert these Turkish characters (ı, ş, ü etc) to readable equivalents (i, s, u etc). Doing this with the code below:
foreach v of var AD {
replace `v'=regexr(`v', "`=char(195)'+`=char(135)'","C")
replace `v'=regexr(`v', "`=char(196)'+`=char(176)'","I")
replace `v'=regexr(`v', "`=char(195)'+`=char(167)'","c")
replace `v'=regexr(`v', "`=char(195)'+`=char(182)'","o")
replace `v'=regexr(`v', "`=char(196)'+`=char(177)'","i")
replace `v'=regexr(`v', "`=char(196)'+`=char(158)'","G")
replace `v'=regexr(`v', "`=char(196)'+`=char(159)'","g")
replace `v'=regexr(`v', "`=char(195)'+`=char(156)'","U")
replace `v'=regexr(`v', "`=char(195)'+`=char(188)'","u")
replace `v'=regexr(`v', "`=char(197)'+`=char(158)'","S")
replace `v'=regexr(`v', "`=char(195)'+`=char(150)'","O")
replace `v'=regexr(`v', "`=char(197)'+`=char(159)'","s")
}
However, this code cannot accomplish the conversion at the first time. Therefore, I have to do it 5 to 10 times to get a (0 real changes made) message.
My question is: can I make this loop run automatically until I get the (0 real changes made) message which indicates that all characters are converted.
Any help will be appreciated
Haluk Vahaboğlu
*
* 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/