SAS: Use PROC FREQ & Show No Percentages


You can use the following methods with PROC FREQ in SAS to create frequency tables and suppress any percentage values in the resulting tables:

Method 1: Suppress Percentages in One-Way Frequency Table

proc freq data=my_data order=freq;
    tables my_variable / nopercent nocum;
run;

Method 2: Suppress Percentages in Two-Way Frequency Table

proc freq data=my_data order=freq;
    tables my_variable1*my_variable2 / norow nocol nopercent nocum;
run;

The following examples shows how to use each method in practice with the SAS built-in dataset called BirthWgt, which contains various characteristics for 100,000 mothers that recently gave birth.

We can use PROC PRINT to view the first 10 observations from this dataset:

/*view first 10 observations from BirthWgt dataset*/
proc print data=sashelp.BirthWgt (obs=10);

run;

Example 1: Suppress Percentages in One-Way Frequency Table

We can use the following code to create a frequency table for the Race variable:

/*create frequency table for Race variable*/
proc freq data=sashelp.BirthWgt;
	tables Race;
run;

frequency table in SAS

By default, SAS displays percentages in the frequency table.

To suppress the percentages, we can use the nopercent and nocum statements:

/*create frequency table for Race variable and suppress percentages*/ 
proc freq data=sashelp.BirthWgt;
    tables Race / nopercent nocum;
run;

SAS PROC FREQ with no percentages

Notice that the frequency table only shows frequency values and no percentage values for each category.

Example 2: Suppress Percentages in Two-Way Frequency Table

We can use the following code to create a two-way frequency table for the Race and Married variables:

/*create frequency table for Race and Married variables*/
proc freq data=sashelp.BirthWgt;
	tables Race*Married;
run;

By default, SAS displays percentages for overall percent, row percent, and column percent for each cell in the frequency table.

To suppress the percentages, we can use the norow, nocol and nopercent statements:

/*create frequency table for Race and Married variables and suppress percentages*/ 
proc freq data=sashelp.BirthWgt;
    tables Race*Married / norow nocol nopercent;
run;

SAS frequency table with no row and no column percentages

Notice that the frequency table only shows frequency values and no percentage values for each cell in the table.

Additional Resources

The following tutorials explain how to perform other common tasks in SAS:

SAS: How to Use PROC FREQ with WHERE Statement
SAS: How to Use PROC FREQ with ORDER Option
SAS: How to Use PROC FREQ by Group

Leave a Reply

Your email address will not be published. Required fields are marked *