If you just want an indicator of evenness, a concise way is...
gen byte newvar = ~mod(oldvar, 2)
-- David K.
At 01:10 PM 3/30/2004 -0500, Danielle Ferry wrote:
Hi,
I apologize if this has been addressed previously. I haven't found
anything in the archives, though I feel as though it surely must be there
somewhere. I am wondering if there is a way to create a new variable that
takes on a value if another variable is an even or an odd number. For
example, can you do something like this:
ge newvar = 1 if oldvar is even
If this has made its way thru the list before, perhaps someone can suggest
better search keywords for the archives? Thanks.
[...]
David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404
*
* 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/