The input SAS data file that is used for the examples given here is shown in
Data File Trans.Banking. If you want to run the examples, make sure that you sort the observations before
you use PROC DBLOAD. Sorting the observations groups them by accounts for each customer,
which produces data in the sequence required for loading the three-level database
Banking.
Each
observation in the input data file represents one transaction. For example, John Booker has four
transactions, two for each of his accounts. His name and account numbers are repeated
in each observation as shown in the following output.
The SAS Data File Trans.Banking
OBS CUSTNAME CUSTID ACCTNUM ACCTTYP TRANSTYP TRANSAMT TRANSDAT
1 BOOKER, JOHN 74-9838 8349 S D $40.00 05JUN89
2 LOPEZ, PAT 38-7274 9896 S D $15.67 23JUN89
3 JONES, APRIL 85-4941 4141 C W $213.78 29JUN89
4 BOOKER, JOHN 74-9838 8349 S I $34.76 30JUN89
5 MILLER, NANCY 07-6163 7890 S I $53.98 30JUN89
6 LOPEZ, PAT 38-7274 9896 S I $16.43 30JUN89
7 JONES, APRIL 85-4941 4141 C W $354.70 30JUN89
8 MILLER, NANCY 07-6163 7890 S D $1,245.87 01JUL89
9 JONES, APRIL 85-4941 4141 C D $2,298.65 01JUL89
10 MILLER, NANCY 07-6163 3876 C W $45.98 08JUL89
11 ROGERS, MIKE 96-5052 4576 C D $75.00 10JUL89
12 BOOKER, JOHN 74-9838 3673 C D $150.00 10JUL89
13 LOPEZ, PAT 38-7274 9896 S D $50.00 10JUL89
14 BOOKER, JOHN 74-9838 3673 C W $65.43 13JUL89
15 ROGERS, MIKE 96-5052 4576 C W $12.34 13JUL89
16 ROGERS, MIKE 96-5052 4576 C W $45.67 13JUL89
17 MILLER, NANCY 07-6163 3876 C D $56.79 14JUL89
18 ROGERS, MIKE 96-5052 4576 C W $12.16
15JUL89
After you sort the input data file by customer name and account type, PROC DBLOAD
loads data for each customer as a logical entry in the SYSTEM 2000 database. Redundant
data is reduced, which saves storage space. The logical entry for John
Booker would look like the following figure.
After you load the input data from Trans.Banking, run the following SYSTEM 2000
LIST
statement in PROC QUEST.
list c1, c101, c102, c201, c202;
Here
are the results.
Output from LIST Statement Run on the Database Banking
* CUSTNAME ACCOUNT NUMBER ACCOUNT TYPE TRANS TYPE TRANS AMOUNT
***
* BOOKER, JOHN 3673 C D $150.00
* W $65.43
* 8349 S D $40.00
* I $34.76
* JONES, APRIL 4141 C W $213.78
* W $354.70
* D $2,298.65
* LOPEZ, PAT 9896 S D $15.67
* I $16.43
* D $50.00
* MILLER, NANCY 3876 C W $45.98
* D $56.79
* 7890 S I $53.98
* D $1,245.87
* ROGERS, MIKE 4576 C D $75.00
* W $12.34
* W $45.67
* W
$12.16
Notice the values shown for John Booker. His name appears only one time, but he has
two account numbers and four transactions. Because the examples that use PROC DBLOAD
rank the data values into levels, you have a clear, logical view of the data.