I have a large number of binary interaction variables in regressions that I create with i., #, and ## operators. I need to produce the cell counts for these variables. If I generated the interactions manually, this would be easy, as I'd just run a foreach loop of the interactions and tabulate them or count if `var'==0 and count if `var'==1. But since I've used the factor variable notation, the interactions aren't saved as variables, and as Nick Cox wrote to answer a different question in 2023, "tabulate knows nothing about interactions."
Is there a workaround than creating all the dummies and the interactions manually?
Is there a workaround than creating all the dummies and the interactions manually?
Code:
sysuse auto, clear set seed 1492 gen cat=floor(runiform(1,5)) reg price weight i.cat##i.foreign summ i.cat##i.foreign //this runs, but isn't quite what I want tab1 i.cat##i.foreign //this is what I'd like count if i.cat##i.foreign ==0 //something like this would also be an option
Comment