Chapter Contents

Previous

Next
SAS/ACCESS Interface to ADABAS Software

Calculating Statistics

You can also use statistical procedures on ADABAS data. This section shows simple examples using the FREQ and MEANS procedures.


Using the FREQ Procedure

Suppose you wanted to find what percentage of your invoices went to each country so that you can decide where to increase your overseas marketing. The following example calculates the percentages of invoices for each country accessed by the NATURAL DDM named INVOICE, using the view descriptor VLIB.INV.

proc freq data=vlib.inv;
   tables country;
   title "Data Described by VLIB.INV";
run;

Frequency Table for Variable COUNTRY Described by View Descriptor VLIB.INV shows the one-way frequency table this example generates.

Frequency Table for Variable COUNTRY Described by View Descriptor VLIB.INV
                  Data Described by VLIB.INV                          

                           COUNTRY

                                        Cumulative  Cumulative
COUNTRY            Frequency   Percent   Frequency    Percent
--------------------------------------------------------------
Argentina                 2      11.8           2       11.8
Australia                 1       5.9           3       17.6
Brazil                    4      23.5           7       41.2
USA                      10      58.8          17      100.0

                             Frequency Missing = 2

For more information about the FREQ procedure, see the SAS Procedures Guide.


Using the MEANS Procedure

In your analysis of recent orders, suppose you also wanted to determine some statistics for each USA customer. In the following SAS program, the view descriptor VLIB.USAORDR accesses data from the NATURAL DDM named ORDER, the SAS WHERE statement selects observations that have a SHIPTO value beginning with a 1, which indicates a USA customer, and the SAS BY statement sorts the data by order number. (Note that both ORDERNUM and SHIPTO are ADABAS descriptor data fields.)

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 observations (N) and the number of missing values (NMISS).

proc means data=vlib.usaordr mean sum n nmiss 
     maxdec=0;
   where shipto like "1%";
   by ordernum;
   var length fabricch;
   title "Data Described by VLIB.USAORDR";
run;

Statistics on Fabric Length and Charges for Each USA Customer shows the output for this example.

Statistics on Fabric Length and Charges for Each USA Customer
                         Data Described by VLIB.USAORDR                        

--------------------------------- ORDERNUM=11269 -------------------------------


Variable  Label                     N         Nmiss          Mean           Sum
-------------------------------------------------------------------------------
LENGTH    LENGTH                    1             0           690           690
FABRICCH  FABRICCHARGES             1             0             0             0
-------------------------------------------------------------------------------

--------------------------------- ORDERNUM=11271 -------------------------------


Variable  Label                     N         Nmiss          Mean           Sum
-------------------------------------------------------------------------------
LENGTH    LENGTH                    1             0           110           110
FABRICCH  FABRICCHARGES             1             0      11063836      11063836
-------------------------------------------------------------------------------

--------------------------------- ORDERNUM=11273 -------------------------------


Variable  Label                     N         Nmiss          Mean           Sum
-------------------------------------------------------------------------------
LENGTH    LENGTH                    1             0           450           450
FABRICCH  FABRICCHARGES             1             0        252149        252149
-------------------------------------------------------------------------------

--------------------------------- ORDERNUM=11274 -------------------------------


Variable  Label                     N         Nmiss          Mean           Sum
-------------------------------------------------------------------------------
LENGTH    LENGTH                    1             0          1000          1000
FABRICCH  FABRICCHARGES             1             0             0             0
-------------------------------------------------------------------------------

--------------------------------- ORDERNUM=11276 -------------------------------


Variable  Label                     N         Nmiss          Mean           Sum
-------------------------------------------------------------------------------
LENGTH    LENGTH                    1             0          1500          1500
FABRICCH  FABRICCHARGES             1             0       1934460       1934460
-------------------------------------------------------------------------------

--------------------------------- ORDERNUM=11278 -------------------------------


Variable  Label                     N         Nmiss          Mean           Sum
-------------------------------------------------------------------------------
LENGTH    LENGTH                    1             0          2500          2500
FABRICCH  FABRICCHARGES             1             0       1400825       1400825
-------------------------------------------------------------------------------

For more information about the MEANS procedure, see the SAS Procedures Guide.


Using the RANK Procedure

You can also use more advanced statistics procedures on ADABAS data. The following example uses the RANK procedure to calculate the order of birthdays for a set of employees. This example creates a SAS data file MYDATA.RANKEX from the view descriptor VLIB.EMPS and assigns the name DATERANK to the new variable (in the data file) created by the procedure.

proc rank data=vlib.emps out=mydata.rankex;
   var birthdat;
   ranks daterank;
run;
proc print data=mydata.rankex;
   title "Order of Employee Birthdays";
run;

VLIB.EMPS accesses data from the NATURAL DDM named EMPLOYEE. Ranking of Employee Birthdays shows the result of this example.

Ranking of Employee Birthdays
                          Order of Employee Birthdays                          

    OBS      EMPID    JOBCODE    BIRTHDAT    LASTNAME              DATERANK

      1     456910       602     24SEP53     ARDIS                     5
      2     237642       602     13MAR54     BATTERSBY                 6
      3     239185       602     28AUG59     DOS REMEDIOS              7
      4     321783       602     03JUN35     GONZALES                  2
      5     120591       602     12FEB46     HAMMERSTEIN               4
      6     135673       602     21MAR61     HEMESLY                   8
      7     456921       602     12MAY62     KRAUSE                    9
      8     457232       602     15OCT63     LOVELL                   11
      9     423286       602     31OCT64     MIFUNE                   12
     10     216382       602     24JUL63     PURINTON                 10
     11     234967       602     21DEC67     SMITH                    13
     12     212916       602     29MAY28     WACHBERGER                1
     13     119012       602     05JAN46     WOLF-PROVENZA             3

For more information about the RANK procedure and other advanced statistics procedures, see the SAS Procedures Guide.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.