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]

Re: st: are Macro variable always possible ?


From   Matthew White <[email protected]>
To   [email protected]
Subject   Re: st: are Macro variable always possible ?
Date   Sun, 28 Aug 2011 18:14:33 +0000

Enclosing it in double quotes should do the trick:
local filter `"var1=="hello"&var2==1&var3==43&var6=="hello
again"&!missing(var34)"'

Best,
Matt

On Sun, Aug 28, 2011 at 5:52 PM, John Litfiba <[email protected]> wrote:
> 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/
>



-- 
Matthew White
Data Coordinator
Innovations for Poverty Action
101 Whitney Avenue, New Haven, CT 06510 USA
www.poverty-action.org

*
*   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