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


From   John Litfiba <cariboupad@gmx.fr>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index