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: interaction variables


From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
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 <[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index