Chapter Contents

Previous

Next
The DATASETS Procedure

Example 5: Concatenating Two SAS Data Sets


Procedure features:
APPEND statement options:
BASE=
DATA=
FORCE=

This example appends one data set to the end of another data set.


Input Data Sets
 Note about figure
                      The EXP.RESULTS Data Set                     1

             ID    TREAT    INITWT    WT3MOS    AGE

              1    Other    166.28    146.98     35
              2    Other    214.42    210.22     54
              3    Other    172.46    159.42     33
              5    Other    175.41    160.66     37
              6    Other    173.13    169.40     20
              7    Other    181.25    170.94     30
             10    Other    239.83    214.48     48
             11    Other    175.32    162.66     51
             12    Other    227.01    211.06     29
             13    Other    274.82    251.82     31

 Note about figure
                      The EXP.SUR Data Set                     2

       id     treat     initwt    wt3mos    wt6mos    age

       14    surgery    203.60    169.78    143.88     38
       17    surgery    171.52    150.33    123.18     42
       18    surgery    207.46    155.22       .       41


Program

options pagesize=40 linesize=64 nodate pageno=1;
libname exp 'SAS-data-library';
 Note about code
proc datasets library=exp nolist;
   append base=exp.results data=exp.sur force;
run;




 Note about code
proc print data=exp.results noobs;
   title 'The EXP.RESULTS Data Set';
run;


Output

                    The EXP.RESULTS Data Set                   2

            ID     TREAT     INITWT    WT3MOS    AGE

             1    Other      166.28    146.98     35
             2    Other      214.42    210.22     54
             3    Other      172.46    159.42     33
             5    Other      175.41    160.66     37
             6    Other      173.13    169.40     20
             7    Other      181.25    170.94     30
            10    Other      239.83    214.48     48
            11    Other      175.32    162.66     51
            12    Other      227.01    211.06     29
            13    Other      274.82    251.82     31
            14    surgery    203.60    169.78     38
            17    surgery    171.52    150.33     42
            18    surgery    207.46    155.22     41


Chapter Contents

Previous

Next

Top of Page

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