You may have a complex data set that includes categorical variables of several levels, and you may wish to create summary tables for each level of the categorical variable.
For example, your data set may include the variable Gender, a two-level categorical variable with levels Male and Female. Your data set may include other categorical variables such as Ethnicity, Hair Colour, the Treatments received by patients in a medical study, or the number of cylinders in motor vehicles.
In any case, you may wish to produce summary statistics for each level of the categorical variable. This is where the aggregate command is so helpful. (more…)