Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: if ... the lot of them


From   Richard Goldstein <richgold@ix.netcom.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: if ... the lot of them
Date   Mon, 29 Sep 2008 16:25:09 -0400

I presume you have this in a program or a do-file; if so, then note that macro 1 is the first thing after the file name

for example, say you have all this in a do-file called da1.do

then you do (or run) this as "do da1"

if instead you "do da1 #" (where # is a number such as 1 or 3 or ...
and change all duration==1 statement to duration==`1', then Stata will change your `1' to whatever # is as you run this

hope this helps,

Rich

Paul O'Brien wrote:

i have a sequence of commands, each of which has included: duration==1.

such as:
list r1 se1 r2 se2 if duration==1 & outcome =="pregnancy" &num==1
metan logrr selogrr if num==1 &outcome=="pregnancy" &duration==1, fixed eform nograph
swapval iud1 iud2 if duration=1 &num==1
...

i need to change the duration frequently and have to change all the commands each time.

is there a way to put all the commands together so i can change the duration just once every time i run the sequence?

i have looked at foreach and forvalues.

thanks

-------------------------------
Dr Paul O'Brien
Raymede Clinic
Westside Contraceptive Services
Westminster Primary Care Trust
Exmoor St
London
W10 6DZ
UK
44 + (0)20 8962 4450
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index