Statalist


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

st: if not iffing in ado


From   "Paul O'Brien" <[email protected]>
To   statalist <[email protected]>
Subject   st: if not iffing in ado
Date   Thu, 9 Oct 2008 09:00:38 +0100

i have a small program to temporarily swap variables using swapval. but i cannot get the 'if' to work.

program swap
// used to swap treatment and control (iud r and se)
version 10
syntax [if]
swapval iud1 iud2
swapval r1 r2
swapval se1 se2
...
end

. local s=1
. swap if `s' ==1
(79 missing values generated)
(84 missing values generated)

. list r1 r2 in 1

     +----------+
     |  r1   r2 |
     |----------|
  1. | 2.8    3 |
     +----------+

...
that's fine, but setting s to 0 still produces a swap

. local s=0

. swap if `s' ==1
(79 missing values generated)
(84 missing values generated)

. list r1 r2 in 1

     +----------+
     | r1    r2 |
     |----------|
  1. |  3   2.8 |
     +----------+

dropping the program does not help.

what am i doing wrong?

thanks.

paul

*
*   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