. egen group = group(varlist)
maps varlist to integers 1 up
. tab group, gen(group)
produces as many dummies as there
are groups.
. contract varlist, zero
produces a reduced dataset in which
every cross-combination (including
empty cells) appears once, with its
frequency.
Nick
[email protected]
Patrick Sturgis
> I would like to be able to produce a variable, or set of
> dummy variables
> whose values represent every cell of a multi-way table. E.g. if I have
> sex*class*educational level, I would automatically obtain a
> variable (or
> series of dummies) with values corresponding to every
> possible combination
> of values on these three variables. Is this possible in stata? Thanks
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/