Suppose you want to determine some statistics for each of your USA customers. The
view descriptor Vlib.UsaORdr accesses records from the
Order table that have a SHIPTO value beginning
with a 1, indicating a USA customer.
The following example
generates the mean and sum of the length of material ordered and the
fabric charges for each USA customer. Also included are the number
of rows (N) and the number of missing values (NMISS).
proc means data=vlib.usaordr mean sum n nmiss maxdec=0;
by shipto;
var length fabricch;
title 'Data Described by VLIB.USAORDR';
run;
The BY statement causes the
interface view engine to generate ordering criteria so that the data is sorted. The following output shows
some of the information produced by this example.
Results of Using the MEANS Procedure
Data Described by VLIB.USAORDR 1
-------------------------------- SHIPTO=14324742 -------------------------------
Variable Label N Nmiss Mean Sum
--------------------------------------------------------------
LENGTH LENGTH 4 0 1095 4380
FABRICCH FABRICCHARGES 2 2 1934460 3868920
--------------------------------------------------------------
-------------------------------- SHIPTO=14898029 -------------------------------
Variable Label N Nmiss Mean Sum
--------------------------------------------------------------
LENGTH LENGTH 2 0 2500 5000
FABRICCH FABRICCHARGES 2 0 1400825 2801650
--------------------------------------------------------------
-------------------------------- SHIPTO=15432147 -------------------------------
Variable Label N Nmiss Mean Sum
--------------------------------------------------------------
LENGTH LENGTH 4 0 725 2900
FABRICCH FABRICCHARGES 2 2 252149 504297
--------------------------------------------------------------
-------------------------------- SHIPTO=18543489 -------------------------------
Variable Label N Nmiss Mean Sum
--------------------------------------------------------------
LENGTH LENGTH 6 0 303 1820
FABRICCH FABRICCHARGES 4 2 11063836 44255344
--------------------------------------------------------------
-------------------------------- SHIPTO=19783482 -------------------------------
Variable Label N Nmiss Mean Sum
--------------------------------------------------------------
LENGTH LENGTH 4 0 450 1800
FABRICCH FABRICCHARGES 4 0 252149 1008594
--------------------------------------------------------------
-------------------------------- SHIPTO=19876078 -------------------------------
Variable Label N Nmiss Mean Sum
--------------------------------------------------------------
LENGTH LENGTH 2 0 690 1380
FABRICCH FABRICCHARGES 0 2 . .
--------------------------------------------------------------
For more information
about the MEANS procedure, see the Base SAS Procedures Guide.