Statalist


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

Re: st: if not iffing in ado


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: if not iffing in ado
Date   Thu, 09 Oct 2008 09:10:25 +0100

Paul O'Brien wrote:
> 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
>
You defining your command to use the -if()- option, but you don't
actually use it anywhere in your code.  Perhaps you want to something
like...

// Note the added 'define'
program define swap
// used to swap treatment and control (iud r and se)
version 10
syntax [if]
// Use the `if' statement
if( `if' == 1){
  swapval iud1 iud2
  swapval r1 r2
  swapval se1 se2
  ...
}
end

See -man syntax##description_of_if- and -help ifcmd- for more information.

Neil

-- 
"We should make things as simple as possible, but not simpler" - Anon (not Albert Einstein)


***********************************************************************
This  message  may  contain  confidential and  privileged  information.
If you  are not the  intended recipient  you should not  disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents.  To do so is strictly  prohibited and may be unlawful.
Please  inform  the  sender that  this  message has  gone astray before
deleting it.  Thank you.

2008 marks the 60th anniversary of the NHS.  It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS  and  would like  an NHSmail  email account, go
to: www.connectingforhealth.nhs.uk/nhsmail
***********************************************************************

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