Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Michael Barker <mdb96statalist@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Create loop for dummy interactions |
Date | Thu, 6 Feb 2014 09:42:30 -0500 |
If you just want to include these in a regression, use factor variables: help fvvarlist i.year##i.state If you want the actual dummies and interactions, use xi help xi xi i.year i.state i.year*i.state Make sure state name is a numeric variable. If it is string, generate a new numeric variable using encode help encode On Thu, Feb 6, 2014 at 9:27 AM, Huang, Bryan <Bryan.Huang@warwick.ac.uk> wrote: > Hi, > > 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. > > Regards, > > Bryan Huang > > > * > * 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/ * * 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/