Skip to main content


Showing posts from May, 2010

Automatically Building Summary Tables based on Variable Type

When working with large datasets, creating & exporting summary/descriptive tables can be a pain, even if you take advantage of looping over the variables in combination with table exporting programs like -tabout- .  The reason is that you want different kinds of summary tables for different kinds of variables.  For categorical string variables you probably want a cross-tab.  Creating tables for numeric variables is less straightforward.  For continuos numeric variables with many categories, you probably want a table with the mean, sd, min, max, and so on.  For numeric variables that are categorical or otherwise limited, you may want a cross-tab.

So, while you could use -ds- to detect the "type" (e.g. string or numeric) of variable you have, this could be misleading if a numeric categorical variable has many values (say 50+).  Another approach could be to decide the type of table you create & export based on the number of unique values of a categorical numeric variabl…