Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: check if a macro contains a value


From   Dimitri Szerman <dimitrijoe@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: check if a macro contains a value
Date   Mon, 16 May 2011 15:29:47 +0100

Hello,

I'm running a big do-file which contains several steps. I would like
to create a macro (a global, I suppose) which contains the steps which
are to be run. For example, I would have a "master" do-file which
would read


global steps 1 2 3
run bigdo.do

where bigdo.do would look like

if 1 in global steps {
 do something
}

if 2 in global steps {
 do something else
}


if 3 in global steps {
 do something different
}


Of course, the if statements above are incorrect, but I *hope* it's
clear what I want to achieve.

The alternative to that would be to create one do-file for each step,
call those from the master file, and comment them out in case I don't
want to run that. But I don't want to do this for reasons I don't want
to discuss right now.

Any ideas how I could achieve that?

Thanks,
Dimitri
*
*   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   |   Site index