Chapter Contents


SAS/ACCESS Interface to ADABAS Software

Updating a SAS Data File with ADABAS Data

You can update a SAS data file with ADABAS data described by a view descriptor, just as you can update a SAS data file with data from another data file. In this section, the term transaction data refers to the new data that are to be added to the original file. You can even do updates when the file to be updated is a Version 6 data file and the transaction data are from a Version 7 source.

Suppose you have a Version 6 data file, LIB6.BIRTHDAY, that contains employee ID numbers, last names, and birthdays. You want to update this data file with data described by VLIB.EMPS, a view descriptor based on the EMPLOYEE DDM. To perform the update, enter the following SAS statements.

proc sort data=lib6.birthday;
   by lastname;

proc print data=lib6.birthday;
   title "LIB6.BIRTHDAY Data File";
   format birthdat date7.;

proc print data=vlib.emps;
   title "Data Described by VLIB.EMPS";

data mydata.newbday;
   update lib6.birthday vlib.emps;
   by lastname;

proc print;
   title 'MYDATA.NEWBDAY Data File';

In this example, the new, updated SAS data file, MYDATA.NEWBDAY, is a Version 7 data file. It is stored in the Version 7 SAS data library associated with the libref MYDATA.

When the UPDATE statement references the view descriptor VLIB.EMPS and uses a BY statement in the DATA step, the BY statement causes a BY clause to be generated for the variable LASTNAME. (Note that a BY statement must reference an ADABAS descriptor data field.) Thus, the BY clause causes the ADABAS data to be presented to the SAS System in a sorted order for use in updating the MYDATA.NEWBDAY data file. However, the data file LIB6.BIRTHDAY had to be sorted before the update, because the UPDATE statement expects both the original file and the transaction file to be sorted by the BY variable.

Data in the Data File to Be Updated, LIB6.BIRTHDAY, Data Described by the View Descriptor VLIB.EMPS, and Data in the Updated Data File MYDATA. NEWBDAY show the results of PRINT procedures on the original data file, the transaction data, and the updated data file.

Data in the Data File to Be Updated, LIB6.BIRTHDAY
                        LIB6.BIRTHDAY Data File                           

             OBS     EMPID    BIRTHDAT    LASTNAME

              1     129540    31JUL60     CHOULAI
              2     356134    25OCT60     DUNNETT
              3     127845    25DEC43     MEDER
              4     677890    24APR65     NISHIMATSU-LYNCH
              5     459287    05JAN34     RODRIGUES
              6     346917    15MAR50     SHIEKELESLAN
              7     254896    06APR49     TAYLOR-HUNYADI

Data Described by the View Descriptor VLIB.EMPS
                          Data Described by VLIB.EMPS                         

             OBS      EMPID    JOBCODE    BIRTHDAT    LASTNAME

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

Data in the Updated Data File MYDATA. NEWBDAY
                            MYDATA.NEWBDAY Data File                          

          OBS      EMPID    BIRTHDAT    LASTNAME              JOBCODE

            1     456910    24SEP53     ARDIS                    602
            2     237642    13MAR54     BATTERSBY                602
            3     129540    31JUL60     CHOULAI                    .
            4     239185    28AUG59     DOS REMEDIOS             602
            5     356134    25OCT60     DUNNETT                    .
            6     321783    03JUN35     GONZALES                 602
            7     120591    12FEB46     HAMMERSTEIN              602
            8     135673    21MAR61     HEMESLY                  602
            9     456921    12MAY62     KRAUSE                   602
           10     457232    15OCT63     LOVELL                   602
           11     127845    25DEC43     MEDER                      .
           12     423286    31OCT64     MIFUNE                   602
           13     677890    24APR65     NISHIMATSU-LYNCH           .
           14     216382    24JUL63     PURINTON                 602
           15     459287    05JAN34     RODRIGUES                  .
           16     346917    15MAR50     SHIEKELESLAN               .
           17     234967    21DEC67     SMITH                    602
           18     254896    06APR49     TAYLOR-HUNYADI             .
           19     212916    29MAY28     WACHBERGER               602
           20     119012    05JAN46     WOLF-PROVENZA            602

For more information about the UPDATE statement, see SAS Language Reference: Dictionary.

Note:   You cannot update ADABAS data directly using the DATA step, but you can update ADABAS data using the following procedures: APPEND, FSEDIT, FSVIEW, and SQL. For more information about updating ADABAS data, see Browsing and Updating ADABAS Data.  [cautionend]

Chapter Contents



Top of Page

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