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]

st: interaction variables


From   "daniele.curzi" <daniele.curzi@unimi.it>
To   statalist@hsphsun2.harvard.edu
Subject   st: interaction variables
Date   Fri, 15 Apr 2011 09:20:13 -0700 (PDT)

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index