Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Wild character in variable names?


From   "sdm1" <[email protected]>
To   <[email protected]>
Subject   st: Wild character in variable names?
Date   Sun, 11 Jan 2009 20:30:01 -0000

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/



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