If you use the CLASS and HISTOGRAM statements in PROC UNIVARIATE to generate a two-way comparative histogram, and the second CLASS variable is formatted such that multiple internal levels are mapped to one formatted level, then entire cells in the comparative histogram might be empty even though valid observations exist in the input data. Alternatively, PROC UNIVARIATE might terminate with an error message such as the following:
ERROR: Read Access Violation In Task [ UNIVARIATE ).
This problem will not occur every time you execute this task as described above because the incorrect result or the abnormal termination is based on the order of the observations in the input data set.
To verify that having empty cells in a two-way comparative histogram is incorrect, use the same data set and PROC FREQ to validate the results, as shown next.
proc freq data=dset;
tables class1*class2 / sparse;
run;
If a FORMAT statement is specified in PROC UNIVARIATE, use the same FORMAT statement in PROC FREQ. The comparative histogram is incorrect if it contains any empty cells when those same cells are nonzero in the corresponding crosstabulation table. All listing output and output data sets will be correct. This includes the instances where the comparative histogram incorrectly has empty cells.
To circumvent the problem described here, specify the ORDER=FORMATTED option for the second CLASS variable, or use PROC CAPABILITY if SAS/QC® is installed.