Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: check if a macro contains a value


From   Dimitri Szerman <[email protected]>
To   statalist <[email protected]>
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index