Previous Page | Next Page

The REPORT Procedure

Example 11: How PROC REPORT Handles Missing Values


Procedure features:

PROC REPORT statement options:

MISSING

COLUMN statement

with the N statistic

Other features:

TITLE statement

Formats: $MGRFMT.

This example illustrates the difference between the way PROC REPORT handles missing values for group (or order or across) variables with and without the MISSING option. The differences in the reports are apparent if you compare the values of N for each row and compare the totals in the default summary at the end of the report.


Program with Data Set with No Missing Values

 Note about code
libname proclib 'SAS-library';
 Note about code
options nodate pageno=1 linesize=64 pagesize=60
        fmtsearch=(proclib);
 Note about code
data grocmiss;
   input Sector $ Manager $ Department $ Sales @@;
datalines;
se 1 np1 50    .  1 p1 100   se . np2 120   se 1 p2 80
se 2 np1 40    se 2 p1 300   se 2 np2 220   se 2 p2 70
nw 3 np1 60    nw 3 p1 600   .  3 np2 420   nw 3 p2 30
nw 4 np1 45    nw 4 p1 250   nw 4 np2 230   nw 4 p2 73
nw 9 np1 45    nw 9 p1 205   nw 9 np2 420   nw 9 p2 76
sw 5 np1 53    sw 5 p1 130   sw 5 np2 120   sw 5 p2 50
.  . np1 40    sw 6 p1 350   sw 6 np2 225   sw 6 p2 80
ne 7 np1 90    ne . p1 190   ne 7 np2 420   ne 7 p2 86
ne 8 np1 200   ne 8 p1 300   ne 8 np2 420   ne 8 p2 125
;
 Note about code
proc report data=grocmiss nowd headline;
 Note about code
   column sector manager N sales;
 Note about code
   define sector / group format=$sctrfmt.;
   define manager / group format=$mgrfmt.;
   define sales / format=dollar9.2;
 Note about code
   rbreak after / dol summarize;
 Note about code
   title 'Summary Report for All Sectors and Managers';
run;

Output with No Missing Values

          Summary Report for All Sectors and Managers          1

            Sector     Manager          N      Sales
            ----------------------------------------
            Northeast  Alomar           3    $596.00
                       Andrews          4  $1,045.00
            Northwest  Brown            4    $598.00
                       Pelfrey          4    $746.00
                       Reveiz           3    $690.00
            Southeast  Jones            4    $630.00
                       Smith            2    $130.00
            Southwest  Adams            3    $655.00
                       Taylor           4    $353.00
                                =========  =========
                                       31  $5,443.00

Program with Data Set with Missing Values

 Note about code
proc report data=grocmiss nowd headline missing;
   column sector manager N sales;
   define sector / group format=$sctrfmt.;
   define manager / group format=$mgrfmt.;
   define sales / format=dollar9.2;
   rbreak after / dol summarize;
run;

Output with Missing Values

          Summary Report for All Sectors and Managers          2

            Sector     Manager          N      Sales
            ----------------------------------------
                                        1     $40.00
                       Reveiz           1    $420.00
                       Smith            1    $100.00
            Northeast                   1    $190.00
                       Alomar           3    $596.00
                       Andrews          4  $1,045.00
            Northwest  Brown            4    $598.00
                       Pelfrey          4    $746.00
                       Reveiz           3    $690.00
            Southeast                   1    $120.00
                       Jones            4    $630.00
                       Smith            2    $130.00
            Southwest  Adams            3    $655.00
                       Taylor           4    $353.00
                                =========  =========
                                       36  $6,313.00

Previous Page | Next Page | Top of Page