Calculating Statistics with ADABAS Data

Using Statistical Procedures

You can use statistical procedures on ADABAS data that is described by view descriptors just as you would with SAS data files. This section shows simple examples using the FREQ, MEANS, and RANK procedures.

Calculating Statistics Using the FREQ Procedure

Suppose you want 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;
The following output shows the one-way frequency table this example generates.
Results of Calculating Statistics Using the FREQ Procedure
                  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 Base SAS Procedures Guide.

Calculating Statistics Using the MEANS Procedure

In an analysis of recent orders, suppose you also want to determine some statistics for each of your USA customers. 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;
The following output shows the results for this example.
Results of Calculating Statistics Using the MEANS Procedure
                         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 Base SAS Procedures Guide.

Calculating Statistics Using the RANK Procedure

You can use advanced statistics procedures on ADABAS data that is described by a view descriptor. 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. The following output shows the result of this example.
Results of Calculating Statistics Using the RANK Procedure
                          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 Base SAS Procedures Guide.