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
Bayesian iRT using bayesmhhow will i code A= 1, B= 2, C=3 ,D=4 in this excel sheet Q1 Q2 Q3 Q4 Q5 Q6 Q7 1 B A A B A D A 2 C B …
Polytomoushow will i code A= 1, B= 2, C=3 ,D=4 in this excel sheet Q1 Q2 Q3 Q4 Q5 Q6 Q7 1 B A A B A D A 2 C B …
Polytomoushow will i code A= 1, B= 2, C=3 ,D=4 in this excel sheet Q1 Q2 Q3 Q4 Q5 Q6 Q7 1 B A A B A D A 2 C B …
problems with nested logit modelHi I am trying to model migration within Sweden using a nested logit model and I have divided Swede…
Combining two datasets which formats are different.Hello everyone, I am trying to make below two dataset merged, but don't know how to make the format…
Subscribe to:
Post Comments (Atom)
0 Response to Creating one variable from multiple dummy variables
Post a Comment