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: Create loop for dummy interactions


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Create loop for dummy interactions
Date   Thu, 6 Feb 2014 14:39:49 +0000

I don't see that you need a loop for either problem. Consultation of
-help factor variables- gives you the basic ideas here. The modern
approach is to invoke factor variables on the fly, rather than pepper
your dataset with extra variables. Assuming 50 or so states (modulo
DC, Puerto Rico, etc.) and so many years, how many variables would you
be asking for?

Nick
[email protected]


On 6 February 2014 14:27, Huang, Bryan <[email protected]>

> I have a panel data set of US state-by-year, and would like to create 1) a loop to generate yearly dummy variables from 1981-2010 and 2) a loop for interaction terms between the year and the state. Would you be able to help me out?
>
> Many thanks in advance. Apologies if it has been asked before, I cannot find it in the archive.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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