Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: question about defining a local

From   Phil Schumm <>
Subject   Re: st: question about defining a local
Date   Sat, 12 Nov 2011 19:34:02 -0600

On Nov 12, 2011, at 6:52 PM, Phil Schumm wrote:
> On Nov 12, 2011, at 5:08 PM, Daifeng He wrote:
>> . local state & st=="CA"
> Note that for what you're doing, you're better off creating an indicator variable, and then using that to restrict your sample (as opposed to trying to store part of a command string in a local macro).  For example:
>    mark ca if state & st == "CA"
>    reg depvar [indepvars] if ca

Sorry, I misread what you had written.  The equivalent would instead be

    mark ca if st == "CA"

I would still assert, however, that you are better off using indicator variables in this case, especially when you are working with the intersection of several conditions (which you may express by combining them with "&" or simply multiplying them together).

-- Phil

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index