Dear reader,
for a project we need to make a regression where we control for industry*year fixed effects. We use 282 sic codes and 1977-2015 as period. We created the following loop:
gen industry = Ac3SIC
encode industry, gen(test)
gen year=year(date)
forvalues a = 1977(1)2015 {
forvalues b = 1(1)288 {
gen y`a'i`b' = 0
replace y`a'i`b' = 1 if year==`a' & test==`b'
foreach var of varlist y`a'i`b' {
sum y`a'i`b', meanonly
if r(mean) == 0 {
drop y`a'i`b'
}
}
}
}
This resulted in almost 4000 dummy variables. For our regression we want to make a categorical variable which replaces those 4000 dummy variables. Can anyone help us with this? Or is there an other way how we should approach this?
Kind Regards,
Jan Blokland
Related Posts with Creating one variable from multiple dummy variables
Tabout: Twoway table of means and sdHi! I'm trying to make a table in Excel (via text-file) with tabout for this syntax: by dichotom: t…
How can we choose the appropriate significance level to interpret based on sample sizes?With the large sample size, we normally somehow interpret the coefficient significant at 10%, but in…
Problem with Fixed effects in Cross Sectional Data RegressionDear STATALIST participants, I am writing to you to ask about fixed effects in cross-sectional data…
Random slopes for categorical variable (3 groups)Dear Stata experts, I'm trying to fit a random slope model for longitudinal dataset. My dependent v…
How to run gravity model PPML with constrained parameter on GDP?Dear professors, I have bilateral trade data for 119 countries and the year 2014. I want to run the …
Subscribe to:
Post Comments (Atom)
0 Response to Creating one variable from multiple dummy variables
Post a Comment