Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Replace one variable when other variable contains certain characters


From   "FUKUGAWA, N." <[email protected]>
To   [email protected]
Subject   st: Replace one variable when other variable contains certain characters
Date   Mon, 19 Dec 2005 12:55:05 +0900

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index