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]

Re: st: question about defining a local


From   Phil Schumm <pschumm@uchicago.edu>
To   statalist@hsphsun2.harvard.edu
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:
*   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