'Summarise/ descriptive statistics for categorical data

I have a dataset in Stata and would like to create a descriptive statistics table. The current problem I have is that my variables are both numerical and categorical. For the numerical variables, I know I can create a table easily with the mean, standard deviation and so on. I have just had a problem with categorical variables. For example, education encompasses 5 levels of different education and I would like to show the proportion of observations for each option within the education variable.This is just part of it. I wanted to create an overall table that has descriptive statistics for other variables, like gender, age, income, level of education and so on.



Solution 1:[1]

I like to use the user-contributed command table1 for this purpose. Type ssc install table1 to access the package.

sysuse auto

table1, vars(price contn \ rep78 cat)

  +------------------------------------------------+
  | Factor               Level   Value             |
  |------------------------------------------------|
  | N                            74                |
  |------------------------------------------------|
  | Price, mean (SD)             6,165.3 (2,949.5) |
  |------------------------------------------------|
  | Repair record 1978   1       2 (3%)            |
  |                      2       8 (12%)           |
  |                      3       30 (43%)          |
  |                      4       18 (26%)          |
  |                      5       11 (16%)          |
  +------------------------------------------------+

Type help table1 for additional options.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cybernike