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: are Macro variable always possible ?


From   John Litfiba <[email protected]>
To   [email protected]
Subject   st: are Macro variable always possible ?
Date   Sun, 28 Aug 2011 19:52:28 +0200

Dear Statalist,

I have a very simple question about macro variables:

I would like to define a macro variable which stores a long sequence
of data restrictions that I use after any IF qualifier when a function
allows it ..

For example instead of writing

 regress Y X if var1=="hello"&var2==1&var3==43&var6=="hello
again"&!missing(var34) ,

I tried to define a macro as

 local filter var1=="hello"&var2==1&var3==43&var6=="hello again"&!missing(var34)

in order to simply write

regress Y X if `filter'

However it doent seem to work as Stata doesnt like at all the part
var1=="hello" (because of the ""), causing an error in the
interpretation...

Has anyone an idea ?

Thank you very much !
Best,
*
*   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