Statalist


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

Re: st: Wild character in variable names?


From   "Fred Wolfe" <[email protected]>
To   [email protected]
Subject   Re: st: Wild character in variable names?
Date   Sun, 11 Jan 2009 14:35:02 -0600

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/



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