Producing Frequency Tables Using PROC FREQ

The FREQ procedure is a descriptive procedure as well as a statistical procedure. It produces one-way and n-way frequency tables, and it concisely describes your data by reporting the distribution of variable values. You can use the FREQ procedure to create crosstabulation tables that summarize data for two or more categorical variables by showing the number of observations for each combination of variable values.



Procedure Syntax

The FREQ procedure can include many statements and options for controlling frequency output. For simplicity, let's consider the procedure in its basic form.


General form, basic FREQ procedure:
PROC FREQ <DATA=SAS-data-set>;
RUN;

where SAS-data-set is the name of the data set to be used.


By default, PROC FREQ creates a one-way table with the frequency, percent, cumulative frequency, and cumulative percent of every value of all variables in a data set.


Variable Frequency Percent Cumulative
Frequency
Cumulative
Percent
Value Number of observations with the value. Frequency of the value divided by the total number of observations. Sum of the frequency counts of the value and all other values listed above it in the table. Cumulative frequency of the value divided by the total number of observations.


For example, the following FREQ procedure creates a frequency table for each variable in the data set Parts.Widgets. All the unique values are shown for ItemName, LotSize, and Region.
     proc freq data=parts.widgets;
     run;

ItemName Frequency Percent Cumulative
Frequency
Cumulative
Percent
Bolt 2930 34.52 2930 34.52
Locknut 3106 36.60 6036 71.12
Washer 2451 28.88 8487 100.00

LotSize Frequency Percent Cumulative
Frequency
Cumulative
Percent
1 4256 50.15 4256 50.15
2 1009 11.89 5265 62.04
3 3222 37.96 8487 100.00

Region Frequency Percent Cumulative
Frequency
Cumulative
Percent
East 2848 33.56 2848 33.56
North 1355 15.97 4203 49.53
South 1706 20.10 5909 69.63
West 2578 30.38 8487 100.00