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, 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 <>
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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index