Download Corporate Data: Bringing Together the Islands of Information with SAS/ACCESS® Software

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Relational model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Functional Database Model wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Corporate Data: Bringing Together the Islands of Information
with SAS/ACCESS· Software
Emily P. Wallace, SAS Institute Inc., Cary, NC
data and translate it into a SAS observation that can be used by
the SAS application.
ABSTRACT
Since many companies have more than one database management
The DBlOAD procedure is supported by the OB2, SOLIDS,
ORACLE. RdbNMS. INGRES, dBASE. DIF and OSI2 Database
Manager products. The DBlOAD procedure creates and loads a
database table or file using a SAS data set as input. Because the
view descriptors used by the SAS/ACCESS products appear to
SAS procedures as a SAS data set, data from one database system
can be quickly migrated to another database system using PROC
DBLOAD.
system, an important concern is how to bring together the data from
these islands of information in the most efficient and effective man-
ner. SAS/ACCESS software provides a transparent link to your
database software. These interfaces allow everyone in the company
from end users to the database administrators to use the tools that
suit their activities to reach the database data and to perfonn their
analysis, reporting, or querying functions. This paper examines the
ways that SAS/ACCESS software integrates into SAS" applications
to deliver database information transparently.
In Release 6.07 the DB2, SOLIDS, ORACLE, and RdbNMS interfaces have been enhanced to support the Sal procedure's PassThrough feature. This feature enables you to pass database~
specific Sal statements directly to the database system for processing. You can pass both SELECT statements and non-SELECT
statements to the database. The Pass-Through facility allows you
to optimize your PROC Sal queries by letting the database system
handle the portions that it can optimize, such as joining two tables
from the same database system, and by letting PROC Sal handle
the portions that the database system cannot do such as joining
two tables from different database systems.
INTRODUCTION
A typical corporate computer installation today consists of a mixture
of hardware platforms, operating systems, telecommunications
products and database systems. Oftentimes this is a result of
events such as corporate mergers or acquisitions and data center
consolidations Of decentralization. Frequently it results in machines
in one location exchanging data with machines of another hardware
type in a remote location. Corporations are finding that consolidating
data from the many different data sources can be a time~consuming
task and that the need for up~to-the-minute information makes the
task of consolidating this data a more challenging job. This paper
discusses the ways that SAS/ACCESS software can be used along
with other SAS products to bring together the data in these islands
of information to produce reports, build applications or pertorm ad
hoc queries.
THE APPLICATION
The parent corporation purchased a large conference hotel in the
Bahamas several years ago. Recently they acquired the casino next
to the hotel and decided to merge the casino and the hotel into the
same business unit. They consolidated the two data centers into
one and are rewriting applications to combine the hotel and the
casino information.
SAS/ACCESS software is a set of individually licensed products
that provide interfaces between SAS software and popular database management systems. They provide transparent access to
your database data so that you can use one set of commands and
applications to get to all of your corporate data. The interface products currently available are for DB2~ IMS, ADABAS7
CA-DATACOMIDB~ and SYSTEM 2000" software on MVS;
SQUDS~ and SYSTEM 2000 software on CMS; ORACLE" on VMS,
AOSNS, and PRIMOS; and RdbNMS· and INGRES· on VMS. Also
there are interface products under OS/2" for dBASE" files, DIP files
and the OS/2 Database Manager. All of these interfaces are currently available with the current production releases of SAS software for their hosts. Other interfaces are under development for
platforms such as Microsoft Windows, VSE and some UNIX operating systems, so many new interfaces will be available within the next
year.
Combined Data Center
Mainframe Running MVS
SAS/ACCESS software consists of the ACCESS procedure, the
intertace engine and in many prOducts the DBLOAD procedure. The
ACCESS procedure is used to create access and view descriptors
for the databases and tables of the database system. The descriptors contain the information required to communicate with the database system and to retrieve the database data for a SAS procedure
or the DATA step.
Figure 1
Two Database Systems on the Same Host
The hotel has always used IMS databases for its corporate data,
and the casino keeps its data in DB2 tables. Both databases are
now running on the same CPU. The parent corporation wants to
plan an advertising campaign for the hotel and casino and has
requested a report of the 1991 profit figures by month to use in the
planning process. The data processing staff asks their SAS wizard
to write a program to produce the report.
The interface engine uses the information in the view descriptor to
translate requests for data from a SAS application into calls that can
be processed by the database system. With the exception of the
DIF engine, all of the interface engines also update database data.
When a SAS application references a view descriptor, it is the interface engine that works behind the scenes to retrieve the database
379
The SAS wizard codes the following statements;
as defined in the DBD. Following the RECORD statement are item
statements for each field in the segment. They supply the 32character name of the field, the level number to indicate groups, the
format that describes the way the data are stored on disk, the name
of any search fields that are defined in the DBD, and whether the
item is a key and a SAS name to use for the field. It is very important
to supply this information correctly because this information is used
by the IMS engine to generate its calls.
proc access dbms:db2;
create sasnser. hotel. access;
table:hotel. accounts;
create sasuser.hotel.view:
select all:
rename total htotal;
format month
2.
year
2.
dollarl~.2
rooms
rest--1lar dollarl~.2
giftshop dollarl~.2
htotal
dollarI6.2;
subset where year: 91;
[un;
proc access dbms·ims;
create sasuser.casino.access;
dbd",finance dbtype"hdam;
record=prof i t sg=prof it sl= 100;
Iv,,) dbf .. 2.
se=month key*y sn",month;
item=month
item"year
Iv=3 dbf~2.
se=year key .. y sn .. year;
item'" slot machines' 1v=3 dbf =1~. 2 se=slots
sn=slots;
item=blackjack
tv=3 dbf=I~.2 se"blkjack sn",blkjack;
item"baccarat
Iv"3 dbf=14.2 se=baccarat sn=baccarat;
item=poker
Iv=3 dbf=U.2 se"'poker
sn=poker;
item='sports bets'
Iv=3 dbf=U.2 se=sportbet sn=sportbet;
item=total
Iv .. 3 dbf:16.2 l'le=total
sn=ctotal;
create sasuser.casino.view psb=cfinance;
select all;
subset where year = 91:
run;
proc sql;
select hotel.month, hotel. year, rooms, resUar, giftshop,
htotal, sum (slots, blkjack, baccarat, poker, sportbet)
as gambling format dollarl4.2,
sum (restaurt, bars) as food format dollarl~.2,
ctotal, sum (htotal, ctotal) as profit format dollarl6.2
from sasuser .hotel, sasuser. casino
where hotel.month .. casino.month and hotel.year " casino. year;
quit;
Once the access descriptor is created, one or more views can be
created. The CREATE statement for the view descriptor must contain the name of the IMS Program Specification Block (PSB) that
will be used by the IMS engine in its calls to the database system.
The SUBSET clause specifies criteria to use in selecting records,
and the IMS engine turns it into Segment Search Arguments (SSAs)
to be used·with the IMS calls when it is possible.
The third step in this program uses PROC Sal to join the IMS and
DB2 data together using the two view descriptors that were just
created. It uses the SUM function to aggregate some of the data
and uses the AS keyword to supply names and formats for the
summed columns. The WHERE clause supplies the joining information to relate the IMS data and DB2 data.
Output 1 shows the summary information from the two database
systems.
1I01l'I'H
ROOKS
YEAR
II~O'rAL
These SAS statements produce a report that displays the profit for
each month in 1991 for the hotel, the casino, and their combined
profit.
The first PROC ACCESS step uses the statement syntax that is
available in Release 6.07 to create an access and view descriptor
for the hotel's accounting table. The first CREATE statement names
the access descriptor, and the TABLE statement following it names
the DB2 table that will be described by the access descriptor.
Because there are no other statements before, the next CREATE
statement, the access descriptor is created with the default values
of no dropped columns, no SAS names and the default formats. The
second CREATE statement creates the view descriptor for the
accounting table. The SELECT ALL statement causes all columns
to be included in the view descriptor, and the RENAME and
FORMAT statements specify names and formats to be used by the
SAS procedures or DATA step when displaying the information. The
SUBSET clause specifies criteria to use in selecting rows and in
most cases is passed to DB2 for processing.
I!ESTJAlI
C~OTA!.
GAKB!.UG
91
$5,221,11~.30
SS56,199.~8
$6,085.336.08 $17,S53,H~.~S
S3,93J,O~4.9B
127.671.775.51
s~,8n.30
91
$1.910.0~2.31
,1.423,n7.09
$9,H3,279.B6 $1~.858.9~8.15
U,S31,QH.56
S27,Gl3.H2.57
S9,290.~~
12
91
S1,910,O~1.lJ
SI,~2l,947.09
S9.H3,219.86 *14,858,948.15
S2.S11,~9~.56
S27,033.712.51
H.290.4~
$21.5Q6,439.~1
SI7.690.U2.71
S17,690,JI42.71
Output 1
The SAS wizard decides to produce the report with a DATA step
program because the report can be tailored. The program statements follow:
proc access dbms=db2;
same access statements
The second PROC ACCESS step creates both access and view
descriptors for the casino's accounting data which are stored in an
IMS database. The access descriptor definition process is more
complicated than it is for DB2 because IMS does not store descrip·
tive information about the contents of its databases. This information must be supplied at access descriptor definition time in order
to correctly process the IMS data. If the access descriptor is stored
in a permanent SAS data library, it can be created once and used
many times to create views so that all of the information does not
have to be supplied every time a new view is needed. The DBD
statement following the first CREATE statement supplies the name
of the IMS database as it is defined in the IMS Database Description
(DBD) control block, and the type field must also match the value
contained in the DBD. There is one record statement for each segment in the database and it supplies the segment name and length
run;
data ..nulL;
merge sasuser .hotel sasuser cas1no;
by month year;
if year=91;
if month = 1
then do;
put 0120 '1991 Profit for Hotel and Casino';
put 0124 '(in millions of dollars)';
put' ';
put ~9 ,------- Hotel -------, ~42
Casino
0161 'Total';
put 'Mon' ~6 'Rooms' ~1~ 'Food' a2l 'Gifts' a30 'Total'
,nB 'Gambling' a48 'Food' i1S6 'Total' a66 'PrOfit':
end;
gambling
(slots + blkjack + baccarat + poker + sportbet)/1000000;
food .. (restanrt + bars)/l000000;
3
380
profit
(htotal + ctotal)/l000000;
):rooms", roomsfl000000; dood1 = resLbar/l00COOO;
:rgifts ~ giftshop/l000000; :rtotall '" htotal/l0COOOO;
:rtota12 ., ctotal/l000000;
put month 2.0 :rrooms 8.3 doodl 8.3 xgHts 8.3 xtotall 8.3
gambling 10.3 food 8.3 :rtota12 9.3 profit lL3 ;
run;
E
Hotel and Casino Data Center
-1~.·.1
.:J.i '~~ ~.~.~B2
1_
~_
Output 2 shows the report produced by the program statements.
IMS
1991 Profit for Hotel and casino
On millions of dollars)
lion
1
-------
RoOlll~
5.22~
7.910
Hotel
rood
Gifts
0.857
0.005
1. 42~
0.009
Total
6.085
9.H3
Gambling
17.653
H.S59
Cas.ino
Food
1.9JJ
2.831
~.. u.JCj
MVS M"mmm,
~;
,
~~~_
-g-.~ .
~il
Total
Total
21.516
17 .690
PS/2
P~ofit
--=---=.1
AS/400
27.672
27.0H
Figure 2
The SAS/ACCESS Interface to AS/400 Data is a product that runs
under base SAS software on OS/2 and uses IBM Corporation's PC
Support/400 software to execute queries on a remole AS/400. A
user running a SAS session under OS/2 can use the AS/400 interface product to retrieve AS/400 data for use by procedures or the
OATA step. The data are fetched directly into the SAS procedure
without storing them in an intermediate SAS file, and the interface
allows both reading and updating of the AS/400 data. There is currently a test version of the product available with Releases 6.06 and
6.07 under OS/2.
Output 2
In order to bring data to the MVS system for analysis, the SAS wizard writes a program that uses the DOWNLOAD procedure that
executes on an OS/2 system to retrieve data from an AS/400 table
and copy it into a SAS data set on the MVS system.
The first two steps in this example are the same as in the previous
example. If the view descriptors have already been created, the first
two steps do not need to be run again.
options eomamid - APpe;
signon os2;
rsubmit os2;
proe download data_travel.receipts out=sasusar.tourdesk;
endrsubmit;
signol! os2;
The third step is a DATA step that combines the IMS and DB2 data
using the MERGE statement, and it joins the IMS and DB2 data
together using the values for the month and year columns of each.
After the merge is done, it is a simple matter to pick out the 1991
information and format a report. Only one statement is needed to
combine the IMS and DB2 data, and the rest of the program is just
specifying formatting information for the report.
run;
The program uses SAS/CONNECT software to download the
AS/400 data to the SAS session running on MVS. The OPTIONS
statement specifies the name of the communications access
method that will be used, and the SIGNON command initiates the
process of logging in to the OS/2 session and starting a SAS execution. Once the SAS session has started, the DOWNLOAD procedure is submitted to the remote OS/2 host for execution. This
causes PROC DOWNLOAD to run under OS/2 to retrieve the
AS/400 table described by the traveJ.receipts view descriptor and
put the data into a SAS data set on MVS. Once the SAS data set
has been created on MVS, it can be combined with the other financial data from IMS and DB2 and used for reports, forecasting,
graphs, or other types of analysis.
Combining, data from two different databases on the same host
becomes very easy with SAS/ACCESS software. Once the view
descriptors are built, you use the same SAS code to combine them
as you would use for combining two SAS data sets. These same
techniques can also be used to build full-screen applications using
SAS/AP' and SAS/FSP~ software.
Databa~e
Systems on Two Hosts
The hotel is adding a tour desk for its guests to use in booking sightseeing, sailing, diving, and other types of excursions. They are purchasing an AS/400" machine and a travel desk software package
for it. They use the AS/400 to handle the reservations, payments
and simple accounting tasks. The hotel needs to transfer the
accounting data to their mainframe in order to incorporate them into
the financial information sent to the parent company. They want to
automate the transfer process so that it can be done easily every
night. Their SAS wizard suggests that they use the new
SAS/ACCESS interface to AS/400 Data in conjuction with
SAS/CONNECT" software to move the financial data from the
AS/400 to the mainframe.
The combination of SAS/ACCESS software and SAS/CONNECT
software makes it easy for you to move data from one host to
another so that you can build applications and reports that summarize all of your corporate information.
381
.EUILD: DISPLAY PlE.PROGRAlI (E)
COMBINING DATA FROM ONE HOST WITH
DATABASE DATA ON ANOTHER HOST
___________ _
I COIIIlIIand •• ~>
nUILD: SOt/RCE PIE.PRQGIIAlI lR) ---- _____________ _
I COJ!IIIIand • __ ,
The parent company keeps all of its financial data in RdbNMS
tables on its CPU at the corporate headquarters. It needs to merge
the hotel and casino financial data with the data from its other business units. The corporate SAS wizard suggests that each business
I 00001 HUT:
I OOO~2
I OOOOl
OOOO~
00005
OOOO~
unit can use SAS/CONNECT software to upload the data to the corporate headquarters. Onoe the SAS data sets are on the corporate
CPU, the wizard can develop applications to analyze this data along
with the corporate financial data stored in the RdbNMS tables. The
wizard decides to build a full-screen application to report on the corporate financial information and to integrate all of the data from the
various businesp units into one application.
I
I
I
I
I
I
I
(
(
I
I
I
I
I
I
I
Parent Company Data Cenler
I
I
I
CC001
00008
00009
00010
00011
00012
00013
000 1~
0001S
0001£
00017
OOOIS
00019
00020
00021
00022
00023
00024
00025
/* do upl-oad fro.m but;ineso unit$ . ,
call di$ploy(upload.program);
submit .!tql continu:e;
create view ytdprf
select •. month.
s"",(total.cproflt)
profit fonoat_dolluIS.2
fro", conn~~t.on to «II> ( 5ele~t ",,"th, ctotal fr"'" I
corp_finance where y... r_92) a, .a.o.er.hcproflt h I
where a."onth • b ... onth and b.yeord992;
endSllb",U;
sutm1lt continlle;
title color_white . 199:1 Year to Date proUt·;
patten1 value_solid color~yello,,;
paUern2 valne_solid co10r=cyao;
pathrnl value.solid color=pink;
proc gchart data=ytdprf;
pie monthl discrete stllllvar.profit
cotltline~white nohead'ng ... tche010r;
run;
endsUbmit;
HHN:
return;
TERM:
return;
a.
a.
. : Hotel and Casino Data Center I
L_.~
'i ' _ DB2
-1..-I ..
j
IMS
~~I
MVS -
"'II
~~
PS/2
Jl-
This program submits statements to Sal for processing using the
SUBMIT Sal CONTINUE command. The Sal statements create
a temporary view called ytdprf that joins data from the uploaded
SAS data set sasuser.hcprofit with data in the RdbNMS table
corp_finance that are obtained using the Pass-Through feature of
SOL When the GCHART procedure references the ytdprf view, the
SELECT statement following the keywords CONNECTION TO ROB
is sent directly to RdbNMS for processing. The data that are
returned from the SELECT statement are formatted as if they were
coming from a SAS file so that the Sal join can occur. The pie chart
produced from the combined RdbNMS and SAS data is then displayed for the chief financial officer.
:1' I
lJ:. ~ i
AS/400
Figure 3
The following menu displays a list of financial reports and graphs
that are in the application.
+r j nane 1.1 Reporting Syshm_________________________________ _
I Command
U~>
~arent
Corporation
_
Finan"ial Reportinq SJ.tea
,
CONCLUSION
,
,
SAS software offers you the flexibility to access your data even if
they are stored on a variety of different hardware platforms and in
a variety of different database systems and files. The powerful analytical, reporting, and graphics tools of SAS software can be used
to build applications that access your corporate data wherever they
reside. You use the same set of programming statements and application tools to work with your data whether they are in a SAS data
set or in a database system. Because SAS applications are portable,
the applications and programs can be moved from one machine to
another as your application needs and database systems change.
The SAS System makes it easy to connect your islands of information.
,
,
,
,
(Month to Date Receipts
(Year to Date Rocolpts
(Honth to Oah Expense.
(Year to Oate Expenses
(Yre profit _ Pie Chart
SAS, SASIACCESS, SASIAF, SASIFSP, SYSTEM 2000, and
SAS/CONNECT are registered trademarks or trademarks of SAS
Institute Inc. in the USA and other countries. ® indicates USA registration. OB2, AS/400, OS/2, and SOLIDS are registered trademarks
or trademarks of International Business Machines Corporation.
If the chief financial officer selects the pie chart of year to date profit,
he is invoking an application to upload the financial data from the
various business centers, join it with the RdbNMS financial data and
produce a pie chart of the profit figures.
Other brand and product names are registered trademarks or trademarks of their respective companies.
The Screen Control Language program that joins the data and produces the pie chart is:
382