There are two straightforward ways to turn string variables into corresponding dummies -- also known as categorical variables -- using Stata. One is an extension of the tab command: tab stringvar, gen(dummy) Another makes use of the fact that you seldom need dummies for their own sake. Usually you want them used in some sort [...]
Archives for posts tagged ‘tabulate’
Looking at your data: table vs. tabulate
Wednesday, 19 November 2008
Last night I got an e-mail from a reader, asking how to keep Stata from clipping long string values in two-way tables. This is his code: clear set obs 10 gen a = "" replace a = "a123456789b123456789c123456789" if _n<5 replace a = "987654321x987654321y987654321z" if _n>=5 gen b = "value " + string(int(_n/4)) tab a [...]