Chapter Contents |
Previous |
Next |
SAS/ACCESS Interface to IMS-DL/I Software |
Using the FREQ Procedure |
options nodate linesize=80; proc freq data=vlib.custinfo; table city; title2 'Cities in the ACCTDBD Database'; run;
Frequency Table for Variable CITY shows the one-way frequency table that this example generates.
Frequency Table for Variable CITY
The SAS System Cities in the ACCTDBD Database CITY Cumulative Cumulative CITY Frequency Percent Frequency Percent -------------------------------------------------------------- CHARLOTTESVILLE 2 20.0 2 20.0 GORDONSVILLE 3 30.0 5 50.0 ORANGE 2 20.0 7 70.0 RAPIDAN 1 10.0 8 80.0 RICHMOND 2 20.0 10 100.0 |
For more information on the FREQ procedure, see SAS Language Reference: Concepts and the SAS Procedures Guide.
Using the MEANS Procedure |
proc sort data=vlib.trans out=mydata.trandata; by soc_sec_number; run; options nodate linesize=80; proc means data=mydata.trandata mean sum n nmiss maxdec=0; by soc_sec_number; var check_debit_amount; title2 'Mean Debit Amount Per Customer'; run;
Statistics on Customer Debit Amounts shows the output for this example.
In the example, the view descriptor VLIB.TRANS selects CUSTOMER, CHCKACCT, and CHCKDEBT segment data from the IMS-DL/I database ACCTDBD. Since the ACCTDBD database is an HDAM and therefore is not indexed, the data described by the view descriptor must be sorted before using PROC MEANS. The sorted data are stored in a SAS data file called MYDATA.TRANDATA, which is then used as input to PROC MEANS.
Note: You can store the sorted data in a temporary data
set if space is a concern.
Statistics on Customer Debit Amounts
The SAS System Mean Debit Amount Per Customer -------------------------- SOC_SEC_NUMBER=156-45-5672 -------------------------- The MEANS Procedure Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ 27 110 4 0 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=178-42-6534 -------------------------- Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ 26 26 1 0 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=234-74-4612 -------------------------- Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ . . 0 1 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=434-62-1224 -------------------------- Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ 162 1620 10 0 ------------------------------------------ |
The SAS System Mean Debit Amount Per Customer -------------------------- SOC_SEC_NUMBER=434-62-1234 -------------------------- The MEANS Procedure Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ . . 0 1 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=436-42-6394 -------------------------- Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ . . 0 1 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=456-45-3462 -------------------------- Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ 66 263 4 0 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=657-34-3245 -------------------------- Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ . . 0 1 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=667-73-8275 -------------------------- The MEANS Procedure Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ 355 1065 3 2 ------------------------------------------ -------------------------- SOC_SEC_NUMBER=667-82-8275 -------------------------- Analysis Variable : CHECK_DEBIT_AMOUNT CHECK_DEBIT_AMOUNT N Mean Sum N Miss ------------------------------------------ . . 0 1 ------------------------------------------ |
For more information on PROC MEANS, see SAS Language Reference: Concepts and the SAS Procedures Guide.
Using the RANK Procedure |
proc rank data=vlib.credits out=mydata.rankcred; var check_credit_amount; ranks crdrank; run; proc sort data=mydata.rankcred; by crdrank; run; options nodate linesize=132; proc print data=mydata.rankcred; title2 'Deposits in Ascending Order'; run;
Ranking of Checking Account Balances shows the result of this example.
Ranking of Checking Account Balances
The SAS System Deposits in Ascending Order CHECK_ CHECK_ CHECK_ CHECK_ SOC_SEC_ CHECK_ACCOUNT_ CREDIT_ CREDIT_ CREDIT_ CREDIT_ OBS NUMBER NUMBER AMOUNT DATE TIME DESC 1 436-42-6394 345620135872 50.00 02APR95 12:16:34 ACH DEPOSIT 2 456-45-3462 345620134522 50.00 05APR95 12:14:52 ACH DEPOSIT 3 156-45-5672 345620123456 100.00 01APR95 12:24:34 ATM DEPOSIT 4 667-82-8275 382957492811 100.00 16APR95 09:21:14 ACH DEPOSIT 5 434-62-1224 345620134663 120.00 28MAR95 10:26:45 ACH DEPOSIT 6 657-34-3245 345620131455 230.00 04APR95 14:24:11 ACH DEPOSIT 7 434-62-1234 345620104732 400.00 02APR95 10:23:46 ACH DEPOSIT 8 234-74-4612 345620113263 672.32 31MAR95 ATM DEPOSIT 9 178-42-6534 745920057114 1300.00 12JUN95 14:34:12 ACH DEPOSIT 10 434-62-1224 345620134564 1342.42 22MAR95 23:23:52 ACH DEPOSIT 11 667-73-8275 345620145345 1563.23 31MAR95 15:42:43 MAIN ST BRANCH DEPOSIT 12 667-73-8275 345620154633 1563.23 31MAR95 15:42:43 BAD ACCT_NUM |
For more information on PROC RANK and other advanced statistics procedures, see the SAS Procedures Guide.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.