Published on :
Reporting SASHELP

One-Way Frequency Report

This code is also available in: Deutsch Español Français
This SAS© script demonstrates the use of PROC FREQ to generate one-way frequency reports. It illustrates two distinct scenarios: first, generating a default frequency report for the 'type' variable from the SASHELP.CARS dataset, including frequency, percentage, cumulative frequency, and cumulative percentage. Second, it shows how to modify this report to display only frequency counts, by suppressing cumulative statistics (NOCUM) and percentages (NOPERCENT) via options on the TABLES statement. This allows for fine customization of frequency report output.
Data Analysis

Type : SASHELP


The script uses the 'cars' dataset from the SASHELP library, which is a standard example dataset provided with SAS installations, requiring no external data management or internal creation.

1 Code Block
PROC FREQ
Explanation :
This block executes PROC FREQ with default parameters for the 'type' variable from the SASHELP.CARS dataset. The resulting report includes frequency, percentage, cumulative frequency, and cumulative percentage, which is the standard behavior of PROC FREQ without specific options on the TABLES statement. A descriptive title is added to the report.
Copied!
1title "Default Report: Frequency, Percent, Cumulative Frequency, and Cumulative Percent";
2PROC FREQ DATA=sashelp.cars;
3 tables type; /*1*/
4RUN;
5title;
2 Code Block
PROC FREQ
Explanation :
This block also executes PROC FREQ on the 'type' variable, but uses the 'nocum' and 'nopercent' options on the TABLES statement. These options suppress the display of cumulative statistics and percentages in the frequency report, respectively, showing only raw frequency counts. A specific title is used for this report.
Copied!
1title "Frequency Counts Only";
2PROC FREQ DATA=sashelp.cars;
3 tables type / nocum nopercent; /*2*/
4RUN;
5title;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.