Producing Listings and Reports Using SAS and Crystal Reports Krishna (Balakrishna) Dandamudi, PharmaNet - SPS, Kennett Square, PA



Similar documents
Crystal Reports Payroll Exercise

Crystal Reports Installation Guide

Setting Up ALERE with Client/Server Data

The purpose of this document is to describe how to connect Crystal Reports with BMC Remedy AR System using ODBC.

TAMUS Terminal Server Setup BPP SQL/Alva

A database is a collection of data organised in a manner that allows access, retrieval, and use of that data.

Introduction to Microsoft Access 2013

Creating Custom Crystal Reports Tutorial

Chapter 4 Accessing Data

Introduction to Microsoft Access 2010

2. Unzip the file using a program that supports long filenames, such as WinZip. Do not use DOS.

Introduction. Why Use ODBC? Setting Up an ODBC Data Source. Stat/Math - Getting Started Using ODBC with SAS and SPSS

How To Create A Powerpoint Intelligence Report In A Pivot Table In A Powerpoints.Com

2. Building Cross-Tabs in Your Reports Create a Cross-Tab Create a Specified Group Order Filter Cross-Tab by Group Keep Groups Together

Getting Started Guide

Technical Paper. Defining an ODBC Library in SAS 9.2 Management Console Using Microsoft Windows NT Authentication

Getting Started Guide SAGE ACCPAC INTELLIGENCE

MicroStrategy Desktop

LPR for Windows 95/98/Me/2000/XP TCP/IP Printing User s Guide. Rev. 03 (November, 2001)

Instructions for Creating an Outlook Distribution List from an Excel File

How To Create A Report In Excel

SAS 9.3 Foundation for Microsoft Windows

Step One. Step Two. Step Three USING EXPORTED DATA IN MICROSOFT ACCESS (LAST REVISED: 12/10/2013)

Release 2.1 of SAS Add-In for Microsoft Office Bringing Microsoft PowerPoint into the Mix ABSTRACT INTRODUCTION Data Access

BID2WIN Workshop. Advanced Report Writing

DP-313 Wireless Print Server

FileMaker 13. ODBC and JDBC Guide

Introduction to PASW Statistics

Installation and Program Essentials

Using Microsoft Office to Manage Projects

No Stress Tech Guide To Crystal Reports XI: For Beginners. By Dr. Indera E. Murphy

Business Insight Report Authoring Getting Started Guide

Search help. More on Office.com: images templates

FileMaker 12. ODBC and JDBC Guide

BusinessObjects Enterprise InfoView User's Guide

Inmagic ODBC Driver 8.00 Installation and Upgrade Notes

SAS 9.3 Drivers for ODBC

CONTACTS SYNCHRONIZER FOR IPAD USER GUIDE

Learn how to create web enabled (browser) forms in InfoPath 2013 and publish them in SharePoint InfoPath 2013 Web Enabled (Browser) forms

STATISTICA VERSION 9 STATISTICA ENTERPRISE INSTALLATION INSTRUCTIONS FOR USE WITH TERMINAL SERVER

Backup Recording Viewer for NS

Sage Intelligence Financial Reporting for Sage ERP X3 Version 6.5 Installation Guide

Password Memory 6 User s Guide

Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide

Voyager Reporting System (VRS) Installation Guide. Revised 5/09/06

for Sage 100 ERP Business Insights Overview Document

Create a New Database in Access 2010

Results CRM 2012 User Manual

Pastel Evolution BIC. Getting Started Guide

Introduction to Microsoft Access 2003

InfoView User s Guide. BusinessObjects Enterprise XI Release 2

MICROSOFT ACCESS 2003 TUTORIAL

Microsoft Access 2010 handout

Suite. How to Use GrandMaster Suite. Exporting with ODBC

Introduction to Microsoft Access XP

Rapid Assessment Key User Manual

Colligo Manager 6.0. Connected Mode - User Guide

Business Objects Version 5 : Introduction

Guide to Installing BBL Crystal MIND on Windows 7

FileMaker 11. ODBC and JDBC Guide

MODULE 2: SMARTLIST, REPORTS AND INQUIRIES

Visual Studio.NET Database Projects

Using Crystal Reports with VFP

TheEducationEdge. Export Guide

Visualization with Excel Tools and Microsoft Azure

Microsoft Office Access 2007 which I refer to as Access throughout this book

FileMaker Pro and Microsoft Office Integration

Legal Notes. Regarding Trademarks KYOCERA Document Solutions Inc.

BIGPOND ONLINE STORAGE USER GUIDE Issue August 2005

Work with the MiniBase App

Configuring the SST DeviceNet OPC Server

Outlook . User Guide IS TRAINING CENTER. 833 Chestnut St, Suite 600. Philadelphia, PA

Getting Started with Crystal Reports Session Description:

Business Intelligence Getting Started Guide

Colligo Manager 6.0. Offline Mode - User Guide

etoken Enterprise For: SSL SSL with etoken

Developing Own Crystal Reports

Affiliation Security

MULTIFUNCTIONAL DIGITAL SYSTEMS. Network Fax Guide

Installation Instruction STATISTICA Enterprise Small Business

Web Intelligence User Guide

Installing Remote Desktop Connection

BRIO QUERY FUNCTIONALITY IN COMPARISION TO CRYSTAL REPORTS

PowerSchool Student Information System

User Guide. Analytics Desktop Document Number:

Asset Track Getting Started Guide. An Introduction to Asset Track

USING STUFFIT DELUXE THE STUFFIT START PAGE CREATING ARCHIVES (COMPRESSED FILES)

Module One: Getting Started Opening Outlook Setting Up Outlook for the First Time Understanding the Interface...

Importing Contacts to Outlook

INTRODUCTION to ESRI ARCGIS For Visualization, CPSC 178

Exploiting Key Answers from Your Data Warehouse Using SAS Enterprise Reporter Software

Microsoft Query, the helper application included with Microsoft Office, allows

ODBC Reference Guide

Business Intelligence Tutorial

STATISTICA VERSION 12 STATISTICA ENTERPRISE SMALL BUSINESS INSTALLATION INSTRUCTIONS

Colligo Contributor File Manager 4.6. User Guide

Installation Instruction STATISTICA Enterprise Server

Hamline University Administrative Computing Page 1

Set Up Hortonworks Hadoop with SQL Anywhere

Transcription:

Producing Listings and Reports Using SAS and Crystal Reports Krishna (Balakrishna) Dandamudi, PharmaNet - SPS, Kennett Square, PA ABSTRACT The SAS Institute has a long history of commitment to openness and ease of use in sharing data between SAS software and other systems. The software industry at large has seen a shift towards a more open data exchange; driven by the ease and low cost of data analysis and reporting tools such as Crystal Reports. The name "Crystal Reports" is a well-known name for many developers using the Microsoft Platform. Crystal Reports belongs to a class of programs that package formats and data into a report object. Programmers can set up a library of reports that clients can select and run. Some prepackaged reports prompt users for parameter values. A typical report generator builds queries of one or more databases. Changes in database contents change the overall result of the queries, and thus leading to a change in the contents of the reports. This paper will demonstrate how listings and reports can easily be generated out of SAS datasets using Crystal Reports. INTRODUCTION After reading this paper you should be able to generate reports from your SAS datasets using Crystal Reports as a reporting tool. In addition, the data and sample reports used in this paper address the key aspects of report generation. Crystal Reports is a complete reporting solution that helps create, manage, and distribute reports via the web or embedded in enterprise applications or exported to a number of popular formats, such as spreadsheet, word processor, HTML, ODBC, and common data interchange formats. Crystal Reports makes it easy to create simple reports, and, it also has the comprehensive tools you need to produce complex or specialized reports. WHAT SOFTWARE DO I NEED? The SAS ODBC driver included with Version 8 (and Version 7) runs under 32-bit Windows (Windows 95, Windows 98, and Windows NT). Other software requirements depend on your hardware configuration and on the data source(s) that you want to access. The environment used to work with the examples in this paper is: Data Source: local SAS data only Configuration: Laptop with Windows XP Professional Requirements: Base SAS 8.2, local data access, base SAS software includes the SAS ODBC driver, but installed the driver separately. OPEN DATABASE CONNECTIVITY (ODBC) ODBC is a standard database access method developed by Microsoft Corporation. ODBC makes it possible to access data from any application, regardless of which database management system (DBMS) is handling the data. The functionality of ODBC involves the insertion of a middle layer, called a database driver, between an application and the DBMS. The purpose of the database driver is to translate the application's data queries into commands that the DBMS understands. To access an ODBC database, you must have the appropriate ODBC 1

driver, in the present scenario it is SAS ODBC Driver. To access data provided by a data source, a connection to the data source must first be established. All data access is managed through that connection. ODBC ARCHITECTURE The ODBC architecture has four components: Application. Performs processing and calls ODBC functions to submit SQL statements and retrieve results. Driver Manager. Loads and unloads drivers on behalf of an application. Processes ODBC function calls or passes them to a driver. Driver. Processes ODBC function calls, submits SQL requests to a specific data source, and returns results to the application. If necessary, the driver modifies an application's request so that the request conforms to syntax supported by the associated DBMS. Data source. Consists of the data the user wants to access and its associated operating system, DBMS, and network platform (if any) used to access the DBMS. The following illustration shows the relationship between these four components. In order to create a report with Crystal Reports: - Install SAS ODBC Driver - Create the SAS ODBC Connection - Create the Report Fig. 1.0 2

INSTALL SAS ODBC DRIVER The SAS ODBC Driver for the SAS System allows third party ODBC compliant Windows applications, such as Microsoft s Excel or Visual Basic or Crystal Reports, open access to SAS data sets. The SAS ODBC Driver is a multi-tiered driver meaning that it does not directly access SAS data sets but rather communicates with either a local SAS ODBC server or a remote SAS/SHARE server. The SAS ODBC Driver supports both local and network DDE and TCP/IP for connection to local ODBC or remote SAS/SHARE servers. Download the SAS ODBC driver from www.sas.com, under Service & Support select Downloads, under SAS System Software Products, select ODBC Drivers, select SAS ODBC Driver (Release 8.2 or Release 9) and follow download instructions. After downloading the file, run SASODBC.EXE to install the driver. The SAS ODBC Driver files will be installed to the Windows System directory. The default install location for the SAS ODBC Driver files is: - V8.2 - C:\Program Files\SAS Institute\ODBC For complete information about SAS ODBC Driver installation, refer to SAS Institute Inc. TS-626 Configuring the SAS V8/V9 ODBC Drivers. CREATE THE SAS ODBC CONNECTION The following example is based on a Windows XP Professional installation. Other Windows versions may differ slightly in icon location or icon naming. To create a data source using the SAS ODBC driver: Double-click on the Data Sources (ODBC) icon. The name of the icon may differ a bit for other versions of Windows Fig. 1.1 3

To add a new data source, select the System DSN tab and Click on the Add button. Fig. 1.2 Scroll down to SAS ODBC Driver and select SAS then click Finish. This opens SAS ODBC Driver Configuration dialog. Fig. 1.3 4

Data Source Name: Enter a name for the data source that you want to access. Description (Optional): In the field, you can supply a description of the data source Server: Define one or more servers (as described in the Servers tab), and then come back to the General tab to make a selection from the Server list. You must specify a server for every data source Records to Buffer: keep the default settings SQL Options: The default settings for these options work best with the most ODBC-compliant applications. However, you can override the defaults by selecting any of the SQL Options listed. Select the box next to the desired option. Fig. 1.4 Define SAS Server: In the Name field, enter a name for the SAS server that you are defining. If you supply a one-part name such as SAS, the SAS ODBC driver infers that the server is local. If you supply a two-part name such as SUGI30.SAS, the driver assumes that the server is remote. Password: Enter the password in the Password field if it is necessary to access the server. Fig. 1.5 If the server is a SAS ODBC server (used to access local data sources), then Local (Single User) is displayed in the SAS Server Type field. If the server is a SAS /SHARE server (used by multiple users), SAS /SHARE (Multi-User) is displayed Select Configure. A configuration dialog appears. 5

Local Options: To invoke a local SAS ODBC server, the SAS ODBC driver uses the information in this dialog. If an instance of SAS ODBC server is already running, the driver finds it and connects to it. Each field in this dialog contains default values which can be changed as required. Fig. 1.6 Libraries Page: Each data source can include multiple data libraries. Provide information about each library that you want to access. Name: enter a name for an existing physical SAS data library that you want to access. Host File: enter the physical name of the library. This must be a valid pathname for the operating system that your data library is stored on. For example, for a library that is stored on a PC in the Windows environment, c:\data\costacct would be a valid pathname. Host File: enter the name of the SAS engine that is required for writing to and reading from this library. Fig. 1.7 Select [<<Add<<] to save your library information. The Library Name is added to the Libraries list at the left. To include another data library with your data source, repeat above steps. 6

Saving Data Source Definition: Select [OK] to save data source definition and return to the Data Sources dialog (ODBC Data Source Administrator). Newly defined data source now appears in the list of Data Sources on the left. Fig. 1.8 CREATING THE REPORT Step 1: Click the Start Page tab if the Start Page is not already visible in Crystal Reports. The New Reports area of the Start Page contains a number of wizards to guide you through the creation of specific types of reports. Since you will be learning reporting concepts here, you can skip the wizards and build your report from scratch. After you have completed this report, you may want to build some reports using the wizards to decide which method of report construction you are most comfortable with. 7

Step 2: In the New Reports area, click Blank Report. The Database Expert dialog box appears. Selecting a data Source The Database Expert provides an integrated tree view of all data sources you can use with Crystal Reports. In the Database Expert, Click the + next to the Create New Connection folder to open up the folder and list the various data sources it contains. Next click the + next to the ODBC (RDO) folder, in the expanded view, to open up the Data Source Selection dialog. Step 3: Click the + next to the ODBC (RDO) folder to open up the Data Source Selection dialog. Highlight the Data Source Name from the list. In this scenario NE- SUG2007 and click Finish. 8

Step 4: Expand the NESUG2007 node of the NESUG2007 connection to see a list of tables. Select AES table and click the [>] arrow to add it to the Selected Tables list, and then click [OK]. The Design tab of the report designer and Field Explorer appears. To insert a field Expand the Database Fields node in the Field Explorer dialog box and expand table and Highlight a field name by clicking the name once. When you highlight a field name, you can review a subset of the values for that field as well as the field type and size by rightclicking the field and selecting Browse Data from the shortcut menu. Drag the selected field onto the Details section of the report. An object frame appears with the Arrow cursor as you drag the field onto the report. Step 5: 9

There are many options in the Crystal Reports and as this paper is more of an overview we will be able to cover a few of the important options here. For complete information on reports generation using Crystal Reports refer to Crystal Reports XI Release 2 User's Guide. DESIGN TAB Mostly used part of the Crystal Reports is the Design tab. It designates and labels the various sections of the report. You can do the initial formatting, place objects in the sections where you want them to appear, specify sorting, grouping, and totaling needs, and so forth. When a field is placed on the report on Design tab, it refers by a frame; it does not associate with the data. This, allows adding and deleting fields and other objects, move them around, set up complex formulas, and more, without connecting to network resources needed to gather the data. DESIGN TAB AREAS When you first begin creating a report, Crystal Reports automatically creates five areas in the Design tab. Report Header: This section is generally used for the report title and other information you want to appear at the beginning of the report. 10

Page Header: This section is generally used for information that you want to appear at the top of each page. Details: This section is used for the body of the report, and is printed once per record. The bulk of the report data generally appears in this section. Report Footer: This section is used for information you want to appear only once at the end of the report (such as grand totals) and for charts and cross-tabs that include data for the entire report. Page Footer: This section usually contains the page number and any other information you want to appear on the bottom of each page. If a group, summary, or subtotal is added to the report, the program creates two additional sections: Group Header: This section typically holds the group name field, and can be used to display charts or cross-tabs that include data specific to the group. It is printed once at the beginning of a group. Group Footer: This section generally holds the summary value, if any, and can be used to display charts or crosstabs. It is printed once at the end of a group. When a group, summary, or subtotal is added, the Group Header area appears directly above the Details area and the Group Footer area appears directly below the Details area. If you set up additional groups, the program creates new group areas between the Details area and the existing Group Header and Group Footer area(s). 11

PREVIEW TAB To preview a report before printing it, click Print Preview on the Standard toolbar. The program gathers the data, makes the necessary calculations, and displays the report in the Preview tab. With the data in place, you can review the spacing and formatting of your report and see the actual results of all your summaries, formula calculations, and record and group selections. GROUP EXPERT Using Group Expert you can group fields on report and can modify existing groups. For example, in medical history listing data can be grouped by Site and Patient. That way, you can group together all medical history records of a patient together. SORT EXPERT Using Sort Expert you can define the sort order of the records in a report. You can add and remove a sort field and define the sort direction (ascending or descending) for the data in your report. For example, in medical history listing data is sorted Site and Patient both in ascending order. 12

FORMULA WORKSHOP: In general you would place the appropriate fields on the report from Field Explorer. Sometimes, however, you need to put data on the report that does not exist in any of the data fields or you want to derive a field based on existing fields. In such cases, you need to create a formula. For example, in the Medical history listing the field CONT has numeric values 1, 2, and. but on report this field should be displayed with character values None, Ongoing, and. This can be achieved by using a formula field which has been derived form MEDHX.CONT field. Another example is, to display AGE in Demographics listing, which is not available in database. Use DateDiff, Crystal Reports built in function, with the "d" or "y" interval type parameter to find the number of days between two dates BIRTHDT and VISDT. You may also use DateDiff with yyyy interval parameter to find the number of years difference between two dates. Formula Fields: CONT and MHNONE are formula fields. These fields are derived from existing fields based on certain conditions using formulas 13

MORE FORMULA EXAMPLES: Few more examples are listed here. Please refer Crystal Reports XI Release 2 User's Guide for further information on Crystal Reports built in functions. Example 1: Example 2: 14

EXAMPLES OF FINISHED LISTINGS 15

16

PRINTING, EXPORTING, AND VIEWING REPORTS Finished reports can be distributed using a variety of methods (printing, faxing, exporting). Printing a report You can print reports by selecting Print on the File menu. The Print dialog box appears. Choose the appropriate settings, and then click OK. The Printing Report dialog box appears showing the progress of your print job. Another way to do this is to click the Print button on the Standard toolbar. Exporting a report Finished reports can be exported to a number of popular formats, such as spreadsheet, word processor, HTML, ODBC, and common data interchange formats. This makes the distribution of information easier. The exporting process requires you to specify a format and a destination. The format determines the file type, and the destination determines where the file is located. For more details, refer to Crystal Reports XI Release 2 User's Guide. Viewing reports In general, the Crystal Report Viewers are page viewers that let you see complete pages of your Crystal reports. The Crystal Reports Viewer XI provides you with an easy way to view and share your Crystal reports (.rpt files). You can download this viewer for free from Business Objects website. 17

CONCLUSIONS I hope this paper has given you a few insights on creating reports out of SAS datasets using Crystal Reports as a reporting tool in general. Maybe you even got a few ideas about adopting this method in larger scale. Most importantly, I hope you see clearly that SAS data files are truly portable and universal. REFERENCES SAS Institute Inc., TS-626 Configuring the SAS V8/V9 ODBC Drivers, SAS Institute Inc. Business Objects, Crystal Reports XI Release 2 User's Guide, Business Objects, ACKNOWLEDGMENTS SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are trademarks of their respective companies. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Krishna (Balakrishna) Dandamudi PharmaNet - Specialized Pharmaceutical Services 415 McFarlan Road, Suite 201 Kennett Square, PA 19348-2412 Work Phone: 610.444.4722 Fax: 610.444.4663 E-mail: bdandamudi@pharmanet.com 18