foreach var of varlist diag* {
On Sun, Jan 11, 2009 at 2:30 PM, sdm1 <[email protected]> wrote:
>
> I have ten variables called diag1, diag2, ... diag10.
>
> I would like to do a replace such that:
>
> replace vara=1 if diag1=="A" | diag2=="A" | diag3=="A" ... .
>
> I would rather not have to write out all ten conditions.
> Is there a wild character, like *, I can use in the variable name so that
> this works:
>
> replace vara=1 if diag*=="A"
>
> Thanks.
>
> Steve
>
> *
> * 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/
--
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
[email protected]
*
* 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/