replace X = "m12" if regexm(Y, "Dec")
etc.
rafal
Quoting "FUKUGAWA, N." <[email protected]>:
Dear all,
Suppose we have string variable Y, and we would like to replace
variable X when variable Y contains certain characters such as
"Dec".
In other words, we want to write;
replace X="m12" if Y (contains "Dec")
replace X="m11" if Y (contains "Nov")
replace X="m10" if Y (contains "Oct") .
How can I write the latter part of command?
Please note Y can be Dec123abc, 456Novpqr, and zzz789Oct.
Thank you in advance.
--
FUKUGAWA Nobuya, Ph.D.
[email protected]
*
* 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/
================
Rafal Raciborski
Graduate student
Department of Political Science
Emory University
301 Tarbutton Hall
1555 Dickey Drive Atlanta, GA 30322
404-378-9826 (home)
[email protected]
http://www.roofoos.net/
*
* 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/