Chapter Contents

Previous

Next
SAS/ACCESS Interface to ADABAS Software

Appending Data with the APPEND Procedure

In earlier releases of the SAS System, the APPEND procedure operated only on SAS data files. You can append data described by SAS/ACCESS view descriptors and PROC SQL views to SAS data files and vice versa. You can also append data described by view descriptors to each other.

In the following example, two personnel managers have kept separate employee records. One manager has kept records in a NATURAL DDM named EMPLOYEE, described by the view descriptor VLIB.ADAEMPS. The other manager has kept records in a SAS data file named MYDATA.SASEMPS. Due to a corporate reorganization, the two sources of data must be combined so that all employee data are stored in the EMPLOYEE DDM. The APPEND procedure can do this.

The data described by the view descriptor VLIB.ADAEMPS and the data in the SAS data file MYDATA.SASEMPS are printed with the following statements and displayed in Data Described by VLIB.ADAEMPS and Data in MYDATA. SASEMPS:

options linesize=80;

proc print data=vlib.adaemps;
   title 'Data Described by VLIB.ADAEMPS';
run;

proc print data=mydata.sasemps;
   format birthdat date7.;
   title 'Data in MYDATA.SASEMPS Data File';
run;

Data Described by VLIB.ADAEMPS
                  Data Described by VLIB.ADAEMPS                        

OBS   EMPID BIRTHDAT LASTNAME           FIRSTNAM        MIDDLENA

  1  119012 05JAN46  WOLF-PROVENZA      G.              ANDREA
  2  120591 12FEB46  HAMMERSTEIN        S.              RACHAEL
  3  123456       .  VARGAS             PAUL            JESUS
  4  127845 25DEC43  MEDER              VLADIMIR        JORAN
  5  129540 31JUL60  CHOULAI            CLARA           JANE
  6  135673 21MAR61  HEMESLY            STEPHANIE       J.
  7  212916 29MAY28  WACHBERGER         MARIE-LOUISE    TERESA
  8  216382 24JUL63  PURINTON           PRUDENCE        VALENTINE
  9  234967 21DEC67  SMITH              GILBERT         IRVINE
 10  237642 13MAR54  BATTERSBY          R.              STEPHEN
 11  239185 28AUG59  DOS REMEDIOS       LEONARD         WESLEY
 12  254896 06APR49  TAYLOR-HUNYADI     ITO             MISHIMA
 13  321783 03JUN35  GONZALES           GUILLERMO       RICARDO
 14  328140 02JUN51  MEDINA-SIDONIA     MARGARET        ROSE
 15  346917 15MAR50  SHIEKELESLAM       SHALA           Y.
 16  356134 25OCT60  DUNNETT            CHRISTINE       MARIE
 17  423286 31OCT64  MIFUNE             YUKIO           TOSHIRO
 18  456910 24SEP53  ARDIS              RICHARD         BINGHAM
 19  456921 12MAY62  KRAUSE             KARL-HEINZ      G.
 20  457232 15OCT63  LOVELL             WILLIAM         SINCLAIR
 21  459287 05JAN34  RODRIGUES          JUAN            M.
 22  677890 24APR65  NISHIMATSU-LYNCH   CAROL           ANNE

Data in MYDATA. SASEMPS
               Data in MYDATA.SASEMPS Data File              

OBS     EMPID    BIRTHDAT    LASTNAME     FIRSTNAM    MIDDLENA

 1     245962    30AUG64     BEDORTHA     KATHY        MARTHA
 2     765432    01MAR59     POWELL       FRANK        X.
 3     219223    13JUN47     HANSINGER    BENJAMIN     HAROLD
 4     326745    21FEB52     RAWN         BEATRICE     MAY

The following statements use the APPEND procedure to combine the data from these two sources:

proc append base=vlib.adaemps 
   data=mydata.sasemps;
run;

proc print data=vlib.adaemps;
   title 'Appended Data';
run;

Appended Data displays the appended data described by the view descriptor VLIB.ADAEMPS. Notice that the data in MYDATA.SASEMPS follow the data described by VLIB.ADAEMPS.

Appended Data
                          Appended Data                                 

OBS   EMPID BIRTHDAT LASTNAME           FIRSTNAM        MIDDLENA

  1  119012 05JAN46  WOLF-PROVENZA      G.              ANDREA
  2  120591 12FEB46  HAMMERSTEIN        S.              RACHAEL
  3  123456       .  VARGAS             PAUL            JESUS
  4  127845 25DEC43  MEDER              VLADIMIR        JORAN
  5  129540 31JUL60  CHOULAI            CLARA           JANE
  6  135673 21MAR61  HEMESLY            STEPHANIE       J.
  7  212916 29MAY28  WACHBERGER         MARIE-LOUISE    TERESA
  8  216382 24JUL63  PURINTON           PRUDENCE        VALENTINE
  9  234967 21DEC67  SMITH              GILBERT         IRVINE
 10  237642 13MAR54  BATTERSBY          R.              STEPHEN
 11  239185 28AUG59  DOS REMEDIOS       LEONARD         WESLEY
 12  254896 06APR49  TAYLOR-HUNYADI     ITO             MISHIMA
 13  321783 03JUN35  GONZALES           GUILLERMO       RICARDO
 14  328140 02JUN51  MEDINA-SIDONIA     MARGARET        ROSE
 15  346917 15MAR50  SHIEKELESLAM       SHALA           Y.
 16  356134 25OCT60  DUNNETT            CHRISTINE       MARIE
 17  423286 31OCT64  MIFUNE             YUKIO           TOSHIRO
 18  456910 24SEP53  ARDIS              RICHARD         BINGHAM
 19  456921 12MAY62  KRAUSE             KARL-HEINZ      G.
 20  457232 15OCT63  LOVELL             WILLIAM         SINCLAIR
 21  459287 05JAN34  RODRIGUES          JUAN            M.
 22  677890 24APR65  NISHIMATSU-LYNCH   CAROL           ANNE
 23  245962 30AUG64  BEDORTHA           KATHY           MARTHA
 24  765432 01MAR59  POWELL             FRANK           X.
 25  219223 13JUN47  HANSINGER          BENJAMIN        HAROLD
 26  326745 21FEB52  RAWN               BEATRICE        MAY

The APPEND procedure also accepts a WHERE= SAS data set option or a SAS WHERE statement to retrieve a subset of the data. In the following example, a subset of the observations from the DATA= data set is added to the BASE= data set. The results are displayed in Appended Data with a WHERE= Data Set Option.

proc append base=vlib.adaemps
   data=mydata.sasemps
      (where=(birthdat>='01JAN60'd));
run;
proc print data=vlib.adaemps;
   title 'Appended Data with a WHERE= Data Set 
      Option';
run;

Appended Data with a WHERE= Data Set Option
            Appended Data with a WHERE= Data Set Option                  

 OBS   EMPID BIRTHDAT LASTNAME           FIRSTNAM        MIDDLENA

   1  119012 05JAN46  WOLF-PROVENZA      G.              ANDREA
   2  120591 12FEB46  HAMMERSTEIN        S.              RACHAEL
   3  123456       .  VARGAS             PAUL            JESUS
   4  127845 25DEC43  MEDER              VLADIMIR        JORAN
   5  129540 31JUL60  CHOULAI            CLARA           JANE
   6  135673 21MAR61  HEMESLY            STEPHANIE       J.
   7  212916 29MAY28  WACHBERGER         MARIE-LOUISE    TERESA
   8  216382 24JUL63  PURINTON           PRUDENCE        VALENTINE
   9  234967 21DEC67  SMITH              GILBERT         IRVINE
  10  237642 13MAR54  BATTERSBY          R.              STEPHEN
  11  239185 28AUG59  DOS REMEDIOS       LEONARD         WESLEY
  12  254896 06APR49  TAYLOR-HUNYADI     ITO             MISHIMA
  13  321783 03JUN35  GONZALES           GUILLERMO       RICARDO
  14  328140 02JUN51  MEDINA-SIDONIA     MARGARET        ROSE
  15  346917 15MAR50  SHIEKELESLAM       SHALA           Y.
  16  356134 25OCT60  DUNNETT            CHRISTINE       MARIE
  17  423286 31OCT64  MIFUNE             YUKIO           TOSHIRO
  18  456910 24SEP53  ARDIS              RICHARD         BINGHAM
  19  456921 12MAY62  KRAUSE             KARL-HEINZ      G.
  20  457232 15OCT63  LOVELL             WILLIAM         SINCLAIR
  21  459287 05JAN34  RODRIGUES          JUAN            M.
  22  677890 24APR65  NISHIMATSU-LYNCH   CAROL           ANNE
  23  245962 30AUG64  BEDORTHA           KATHY           MARTHA

For more information on the APPEND procedure, see the SAS Procedures Guide.


Chapter Contents

Previous

Next

Top of Page

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