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/