The FREQ Procedure

Missing Values

When the value of the WEIGHT variable is missing, PROC FREQ does not include that observation in the analysis.

PROC FREQ treats missing BY variable values like any other BY variable value. The missing values form a separate BY group.

If an observation has a missing value for a variable in a TABLES request, by default PROC FREQ does not include that observation in the frequency or crosstabulation table. Also by default, PROC FREQ does not include observations with missing values in the computation of percentages and statistics. The procedure displays the number of missing observations following each table.

PROC FREQ also reports the number of missing values in output data sets. The TABLES statement OUT= data set includes an observation that contains the missing value frequency. The NMISS option in the OUTPUT statement provides an output data set variable that contains the missing value frequency.

The following options change the way in which PROC FREQ handles missing values of TABLES variables:

MISSPRINT

displays missing value frequencies in frequency or crosstabulation tables but does not include them in computations of percentages or statistics.

MISSING

treats missing values as a valid nonmissing level for all TABLES variables. Displays missing levels in frequency and crosstabulation tables and includes them in computations of percentages and statistics.

This example shows the three ways that PROC FREQ can handle missing values of TABLES variables. The following DATA step statements create a data set with a missing value for the variable A:

data one;
   input A Freq;
   datalines;
1 2
2 2
. 2
;

The following PROC FREQ statements request a one-way frequency table for the variable A. The first request does not specify a missing value option. The second request specifies the MISSPRINT option in the TABLES statement. The third request specifies the MISSING option in the TABLES statement.

proc freq data=one;
   tables A;
   weight Freq;
   title 'Default';
run;
proc freq data=one;
   tables A / missprint;
   weight Freq;
   title 'MISSPRINT Option';
run;
proc freq data=one;
   tables A / missing;
   weight Freq;
   title 'MISSING Option';
run;

Figure 3.12 displays the frequency tables produced by this example. The first table shows PROC FREQ’s default behavior for handling missing values. The observation with a missing value of the TABLES variable A is not included in the table, and the frequency of missing values is displayed following the table. The second table, for which the MISSPRINT option is specified, displays the missing observation but does not include its frequency when computing the total frequency and percentages. The third table shows that PROC FREQ treats the missing level as a valid nonmissing level when the MISSING option is specified. The table displays the missing level, and PROC FREQ includes this level when computing frequencies and percentages.

Figure 3.12: Missing Values in Frequency Tables

Default

The FREQ Procedure

A Frequency Percent Cumulative
Frequency
Cumulative
Percent
1 2 50.00 2 50.00
2 2 50.00 4 100.00
Frequency Missing = 2

MISSPRINT Option

The FREQ Procedure

A Frequency Percent Cumulative
Frequency
Cumulative
Percent
. 2 . . .
1 2 50.00 2 50.00
2 2 50.00 4 100.00
Frequency Missing = 2

MISSING Option

The FREQ Procedure

A Frequency Percent Cumulative
Frequency
Cumulative
Percent
. 2 33.33 2 33.33
1 2 33.33 4 66.67
2 2 33.33 6 100.00



When a combination of variable values in a two-way table is missing, PROC FREQ assigns 0 to the frequency count of the corresponding table cell. By default, PROC FREQ does not include missing combinations in the LIST display or the OUT= output data set. To include missing combinations in the LIST display and the OUT= output data set, you can specify the SPARSE option in the TABLES statement.