For an overview of discrete variables, you use frequency tables and charts. A frequency table can show the following:
- The values
- The count of the values, or the absolute frequency
- The proportion of the value, or the absolute percentage
- The cumulative frequency
- The cumulative percent
- Plus, you can create a bar chart or a histogram of the values' absolute percentage
Minimally, you need to calculate the counts of the distinct values of the variable.
Let me start with calculating the frequencies with T-SQL. Window aggregate functions are very handy here. The following query is a very efficient one. If you look at the first part of the query, you'll notice that there is a common table expression (CTE) query that calculates the absolute numbers, or the counts. The cumulative values—...