Bookmark and Share

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

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

st: check if a macro contains a value

From   Dimitri Szerman <>
To   statalist <>
Subject   st: check if a macro contains a value
Date   Mon, 16 May 2011 15:29:47 +0100


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

where 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?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index