SAS System viewer, 8

advertisement
SAS System Viewer 8.2 – Great tool for Data managers and Programmers to browse SAS
Data sets
Harpreet Sahni
CDM Programming Manager, AstraZeneca
checking of data and validation of simple
edit checks.
Abstract
The SAS System Viewer 8.2 is an
application for viewing and printing files
that are created by the SAS System. The
Viewer provides a quick and convenient
way for non SAS savvy people as well as for
SAS programmers to view the contents of
SAS output files without invoking the entire
SAS System, or even having the SAS
System installed on the computer. The SAS
Viewer can be used to open a SAS data set,
Catalog, Transport, JMP®, HTML and all
text based files. It is a freely distributed
application, available at the SAS web site.
Old Solution
SAS databases reside either on NT, UNIX or
other commonly available platforms. To
open a SAS data set on the servers, data
managers needed user accounts (for UNIX
servers) and installation of base SAS on
their desktop. To provide UNIX access, an
administrator had to create user accounts.
Security had to be maintained so that data
managers could not overwrite or change the
contents of the data. All this meant
additional cost in terms of maintenance on
the servers and SAS licenses.
This paper describes how the SAS System
Viewer has helped SAS users and
programmers to overcome limitations
imposed by systems and processes that were
in place before its implementation. It also
describes the key features of the SAS
System Viewer along with sample SAS data
set, how those features are being used and
finally, some limitations of SAS Viewer.
To provide a quick view of data sets to the
data managers, where they did not have
access to Clinical Database, programmers
normally ran the PROC PRINT on each
data set in the database. The results were
then sent to the data managers either as a
hard copy or via e-mail. Sending these huge
files over the network via e-mail would lead
to slow network traffic. One of the
responsibilities of the clinical data mangers
is to validate the clinical databases vs. paper
CRF. In order to facilitate that process,
programmers ran PROC CONTENTS on the
SAS database and provided the SAS System
output to the data managers. This process
was cumbersome and time consuming.
Introduction
SAS is one of the most widely used software
at pharmaceutical companies – programmers
and statisticians use SAS programs to check
and analyze the clinical data, and the
Clinical Databases created using SAS are
used for submission to FDA.
New Solution
SAS System Viewer 8.2 provided answers
to lot of issues. SAS Viewer is a freely
In Clinical Data Management, the data
managers are solely dependent on
programmers to provide access to clinical
databases for browsing, ad hoc listings,
1
distributed application, available at the SAS
web site
http://www.sas.com/apps/demosdownloads/s
assysview_PROD_8.2_sysdep.jsp?packageI
D=000176.
Viewer doesn’t require any special users’
licenses. It allows viewing and printing of
files created by the SAS system. It opens the
SAS data sets in a read only mode, thereby
preventing data managers from overwriting
or updating the data.
FDA's general guidance for electronic
submissions, the SAS System Viewer is
listed as one of the tools used by the agency
to view SAS XPORT transport files and
SAS data sets directly.
(http://www.sas.comgovedu/fda/fdaviewer.h
tml). This helped getting a buy in from IS
and the users.
Some other challenges we faced during and
post SAS System Viewer implementation
were:
 We had to come up with a process of
getting users access for NFS mount
for viewing data sets. This involved
getting a buy in from IS.
 Help desk had to be educated to
troubleshoot issues related to SAS
System Viewer.
 The user base had to be educated in
the use of the tool. We had to
prepare all teaching material and
hold special training sessions. So far
we have about 150 users using this
tool.
 An ongoing challenge we face is that
if a UNIX data set is opened for
viewing and editing at the same time,
no warnings are given by the tool.
The only way programmers know
that this has happened is that it does
not allow them to upload/update the
opened data set.
SAS System Viewer is platform independent
and can open NT or UNIX (or other
commonly available platforms) based SAS
data sets. It allows users to access data sets
that reside on:
 Local drive
 Over the mapped network drive
 On other servers using FTP or http.
If the users don’t have user accounts on
servers, the NFS mount (on UNIX) can be
set up and then the data sets be accessed on
mapped NT drives. In addition to browsing
data sets, SAS System Viewer has other
features such as filtering of data. This helps
data managers to do simple ad-hoc listings
without having to learn SAS.
SAS Viewer allows viewing of data
structures/meta data, exporting data sets or
SAS outputs to .txt or .csv (comma
separated files) files and printing the output
and listing files created by the SAS System
without exporting or converting to Word
documents.
Key Features and their Usefulness for
Data Managers and Programmers
The following section of the paper describes
the key features of the SAS System Viewer
8.2.
In the example, a very generic SAS data set
is used. It contains following variables:
Challenges/Lessons Learned
Implementing SAS Viewer
The task of implementing any software in a
tightly regulated environment, especially
pharmaceuticals, is challenging. But what
helped greatly while implementing the SAS
System Viewer was the fact that, in the
2
Figure 1 shows the variable names in demog1 data set.
/* SAS code for getting the contents of
demog1 */
proc contents data=demog1
details;
run;
Figure 2. Partial output generated from proc contents in demog1
data set.
Accessing Files Over Network Using FTP or
HTTP
Using SAS System Viewer, users can open
files over the network by entering their user
id, password and full file path under File
menu – Network Open.
For example, to open a SAS data set
demog1.sd2 on UNIX server test1 as user
tiger and password hello the following
information will be entered in the network
open dialog box:
 Userid: tiger
 Password: hello
 Path: ftp://test1//<file path
name>/demog1.ssd01
The same level of information can be
viewed using SAS System Viewer’s View
Menu and selecting the sub menu Variables
(figure 3). The View Variables option shows
the following attributes of the opened SAS
data sets:
 Variable name, length, type, format,
informat and label (figure 4)
Batch Submit
SAS System Viewer allows
users/programmers to create new SAS
program files and Batch Submit the code to
the SAS System for processing.
Using Properties sub menu under File menu,
other logistics of a data set can be viewed
such as:
 Number of rows/observations
 Number of columns/variables and
 Date the data set was created or
modified.
Viewing Variables (Partial output from proc
contents)
The CONTENTS procedure in SAS shows
the contents of SAS data sets.
3
Figure 3. How to get the content information of a SAS data set
with SAS system viewer.
Figure 5. How to view Labels and Variables along with the data
with SAS System Viewer
Figure 4. The attributes of demog1 data set in SAS System Viewer
8.2
Figure 6. Labels and Variables as the column headers in ViewHeaders and Names
Viewing Data set with Variable and Labels
Simple queries for Ad-hoc Reports
While browsing/programming a data set, it
is helpful to have labels and data set
variables together. Using SAS System
Viewer’s Headers and Names option under
View menu, the data can be browsed with
labels and variable names together as
column headers.
Using SAS system Viewer’s Filter Option,
under View menu, simple queries can be run
on a sample data set. The Filter has two
options Show all observations
allowed by memory
4

Figure7. The where filter
Show selected number of
observations. Selecting this
option helps in quick
browsing of large data sets
like Labs.
The Filter uses the where clause, order by
and row fetching option. The row fetching
option provides more resources for other
applications and speeds up the viewing
process of SAS generated files when a small
range of observations is retrieved from the
file. The complete set of observations can be
viewed using Page Up and Page Down sub
menu option (arrows on toolbar). If the
Viewer is not able to open an entire file in
memory, the sorting and filtering options are
disabled from use for that particular file.
Hiding/Choosing Variables
The Filter on the active files can also be set
in the tab -Grid Filter under the Menu
View/Options.
SAS System Viewer allows the drop and
keep functionality of SAS system without
actually changing the data set. Using Choose
Columns option under Edit menu, the user
can choose and hide columns in a data set.
In SAS the following code is used to drop or
keep the variables in the output data set-
The Filter feature of SAS System Viewer
allows programmers and data managers to
validate simple edit checks or listings.
data demog1 (drop= salary cars
age);
set demog1;
run;
The simple queries on the example data set
are:
1. where name contains ‘Henry’
2. where status = ‘D’ and children = ‘2’
3. where status in (‘D’, ‘S’) and salary
> 10000
4. where (gender = ‘M’ OR status =
‘D’) and salary > 10000
5. not (status in (‘M’ , ‘S’))
6. where children != “ “
/*OR */
data demog1 (keep= name DOB
gender weight
height);
set demog1;
run;
In Viewer the following steps are used to
choose columns/variables to be displayed
from the data set
1. Click Choose and Hide column
under Edit menu.
2. Select the variable to be
displayed in the data set by
To go back to the complete data set from the
filtered data, the user will have to
clear/delete the where clause from the filter
window.
5
If the user doesn’t have SAS system viewer,
then programmers can copy the data set to
MS Excel and e-mail the data as Excel file.
highlighting on its name on left
hand side panel (Available
Columns)
3. Click on the single arrow.
4. Click OK.
The data set can be saved as .txt or .csv file
directly from SAS System Viewer using File
Save As option under File menu.
Initially all the variables will be on the right
hand side panel (Display Columns). Click
on double arrows to bring all the variables to
the left hand side panel.
/* SAS code for exporting data set to .csv
file */
proc export data=demog1
The Filter Option can be applied on the
displayed variables. The position/order of
the displayed columns can be also changed
using this option.
outfile="C:\demog1.csv"
dbms=csv;
Printing Option -Setting Headers/Footers
Figure 8. How to choose variables/columns to be displayed in
the data set
The Grid Header/Footer tabbed dialog that
exists in the Page Setup dialog box under
File menu, can be used to set the Headers
and Footers on a data set. The header/footer
format can be customized like any other
Windows application by adding header and
footer tokens listed below.
In the space provided, enter the text that you
want to appear in a specific region as left
aligned, centered, or right aligned. Left
aligned, centered and right aligned text need
to be separated with a comma.
$F
$A
$P
$N
$D
Copying Data set to Excel or Saving Data set
as CSV file
The complete data set can be copied and
pasted into an Excel spreadsheet. To keep
the format of each variable intact in Excel,
format the complete spreadsheet as text.
SAS System Viewer allows sorting
(ascending or descending) on just one
variable, but taking the data set to Excel
allows sorting on up to three columns.
File name of the document
Application name
Page number
Number of pages
Date
Tips for Programmers
To make the browsing easier for the users,
the programmers can sort and order the
variables in the data set prior to saving on
the network. Since SAS System Viewer
cannot apply user defined format decodes to
the data, the programmers can provide
format catalog information in the form of
text file along with the data sets.
6
of SAS Institute Inc. in the USA and other
countries.
/* SAS code for getting information about
formats and informats is in the catalog that
is specified in the Library */
Other brand and product names are
trademarks of their respective companies.
PROC FORMAT FMTLIB LIBRARY=LIBRARY.FORMATS;
Run;
Contact Information
I welcome your comments or questions.
Contact the author at:
Conclusion
The SAS System Viewer is an easy-to-use
tool. Despite some limitations of the tool
and new processes we had to create and
implement, programmers and data managers
have greatly benefitted from its
implementation.
Email: Harpreet.Sahni@astrazeneca.com.
Work Phone: 302-886-8227.
Further, the software has no license costs
associated with it. It has led to additional
cost savings. The data managers have been
empowered by reducing their dependency
on programmers and the programmers have
more time available to perform other tasks.
Just the fact that more than 150 users are
using the tool is a testament to its
functionality and use.
References
 SAS system viewer documentation
available at the SAS web site:
http://www.sas.com/apps/demosdownloads/s
etupcat.jsp?cat=Base+SAS+Software


SAS system Viewer online help.
SAS Institute, Inc., SAS ® Online
Doc.
Acknowledgments
Many thanks to Karin LaPann and Robert
Schechter for their helpful comments on this
paper.
Trademarks
SAS and all other SAS Institute Inc. product
or service names are registered trademarks
7
Download