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 at the end of May, and its replacement, statalist.org is already up and running.


[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 <melanieleis@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index