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: can I use a global macro as a trigger?


From   Melanie Leis <[email protected]>
To   statalist <[email protected]>
Subject   st: can I use a global macro as a trigger?
Date   Wed, 29 May 2013 16:01:39 -0600

Hello all,

I have a .do file for which I need to run different sections depending
on whether what I'm doing is a standard or a special scenario.
Ideally, I would like to use a macro to trigger this, so that at the
beginning of my .do file I just have to specify my global type as
standard or special, and then have it automatically know which part of
the code to run.  The idea of what I want to do is something like:

global type standard

if ${type}=="standard" {

"run code"

}
else if ${type}=="special"{

"run other code"

}

I understand that the if command does not work like this (it's looking
for variables), but is there a way that I could use this global
command at the beginning of my .do file to indicate which part of the
code to run?

Thanks!

Melanie
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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