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

From   John Litfiba <>
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

Has anyone an idea ?

Thank you very much !
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index