A SERVICE OF

logo

Accessing DBMS Data with the LIBNAME Statement Calculating Statistics from DBMS Data 259
Using the APPEND Procedure
In this example, the DB2 table Payroll2 is appended to the DB2 table Payroll with
the APPEND procedure. The Payroll table is updated on DB2.
Note: When you append data to a DBMS table, you are actually inserting rows into
a table. The rows can be inserted into the DBMS table in any order.
libname mydblib db2 ssid=db2;
proc append base=mydblib.payroll
data=mydblib.payroll2;
run;
proc print data=mydblib.payroll;
title ’PAYROLL After Appending PAYROLL2’;
format birth datetime9. hired datetime9.;
run;
Note: In cases where a DBMS table that you are using is in the same database
space as a table that you are creating or updating, you must use the LIBNAME option
CONNECTION= SHARED to prevent a deadlock.
Partial output for this example is shown here.
Output 13.19 Using the APPEND Procedure
PAYROLL After Appending PAYROLL2 1
OBS IDNUM SEX JOBCODE SALARY BIRTH HIRED
1 1919 M TA2 34376 12SEP1960 04JUN1987
2 1653 F ME2 35108 15OCT1964 09AUG1990
3 1400 M ME1 29769 05NOV1967 16OCT1990
4 1350 F FA3 32886 31AUG1965 29JUL1990
5 1401 M TA3 38822 13DEC1950 17NOV1985
6 1499 M ME3 43025 26APR1954 07JUN1980
7 1101 M SCP 18723 06JUN1962 01OCT1990
8 1333 M PT2 88606 30MAR1961 10FEB1981
9 1402 M TA2 32615 17JAN1963 02DEC1990
10 1479 F TA3 38785 22DEC1968 05OCT1989
11 1403 M ME1 28072 28JAN1969 21DEC1991
12 1739 M PT1 66517 25DEC1964 27JAN1991
13 1658 M SCP 17943 08APR1967 29FEB1992
14 1428 F PT1 68767 04APR1960 16NOV1991
15 1782 M ME2 35345 04DEC1970 22FEB1992
16 1244 M ME2 36925 31AUG1963 17JAN1988
17 1383 M BCK 25823 25JAN1968 20OCT1992
18 1574 M FA2 28572 27APR1960 20DEC1992
19 1789 M SCP 18326 25JAN1957 11APR1978
20 1404 M PT2 91376 24FEB1953 01JAN1980
Calculating Statistics from DBMS Data
This example uses the FREQ procedure to calculate statistics on the DB2 table
Invoices.