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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: interaction variables


From   "Dimitriy V. Masterov" <dvmaster@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: interaction variables
Date   Fri, 15 Apr 2011 12:25:41 -0400

Daniele,

If you have Stata 11, you can just add a term to your regression like
this using factor variables:

reg y x1 x2 i.country##i.time

This will include both country and time dummies as well as their
interaction in your specification. If you just want the interaction,
use only one #.

DVM
On Fri, Apr 15, 2011 at 12:20 PM, daniele.curzi <daniele.curzi@unimi.it> wrote:
> Dear Stata Members, I have to generate interaction variables between a
> country dummy and a time variable!
>
> I have a dataset with 50 countries. So using the tabulate command I get 50
> dummy variables (country1, country2,....country 50). Now I want to multiply
> all these variables for a time variable! In this case I will generate 50 new
> variables!
>
> To do that, I can multiply each country dummy for the time variable.
>
> gen cy1=country1*year
>
> gen cy2=country2*years
>
> ....
>
> gen cy50=country50*years
>
> I was wondering if there exist any command to make this in a faster way!
>
> Thanks for your help
>
> --
> View this message in context: http://statalist.1588530.n2.nabble.com/interaction-variables-tp6276860p6276860.html
> Sent from the Statalist mailing list archive at Nabble.com.
> *
> *   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/
>

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