SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Computing Frequency Distributions
Producing Frequency Tables


Procedure Syntax

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


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

where SAS-data-set names 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 of all variable values in the data set Parts.Widgets.
     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



  back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement