USING SAS ON THE MAINFRAME

VERSION 6.09


 

 This handout documents using SAS version 6.09 on the MVS mainframe.

As oc October 1, 2002, the default version of SAS on the MVS mainframe, when using "// EXEC SAS", is version 8.2.  You can still execute version 6.09 by using "// EXEC SAS6".  The JCL examples in this  handout have been changed to reflect this.


Introduction
Current Release
Related Documentation
SAS Institute Training
Related ARDC Documents and Training
SAS Utilization on MVS (BATCH)
Reading Version 5 SAS Datasets and User-Defined Libraries

Introduction

The Statistical Analysis System (SAS) is a set of computer programs used with relatively simple commands to produce a variety of statistical analyses.  SAS will perform simple descriptive statistics, crosstabulations, analysis of variance, regression and factor analysis, and time series analysis, as well as user-formatted reports.  This documentation gives information about using SAS at USC, including which SAS release is current, a listing of available documentation, examples of JCL needed for submitting batch SAS jobs through MVS, and procedures for running SAS programs under VM/CMS.

This documentation was produced by the Academic Research and Data Center of USC.  Questions about its content, as well as questions about SAS procedures, should be directed to a SAS consultant at 777-6865.

NOTE:  For information on SAS modules under USC site license for DOS, Windows, OS/2 and Macintosh operating systems, refer to the handout PCSAS.

Current Release

Version 6.09 in batch mode on MVS.  The SAS/GRAPH, SAS/ETS, SAS/IML are also available.  The SASPROCS documentation outlines enhancements and new procedures in SAS 6 and should also be referenced.

Related Documentation

The following SAS Institute publications document SAS 6 and are available for reference from the Academic Research and Data Center, TC Library, Level 5.  They may be purchased directly from SAS Institute, Box 8000, Cary, NC 27511 (919-467-8000).  Refer to the SAS Institute Publications page for detailed information on publications.

SAS Language and Procedures: Introduction, Version 6, First Edition.  Provides introductory information about base SAS software and features a task-oriented tutorial designed for new users.

SAS/GRAPH Software: Introduction, Version 6, First Edition.  Introduces new SAS/GRAPH software users to producing charts, plots, maps, and text slides.

SAS Language and Procedures: Usage, Version 6, First Edition.  Task- oriented guide that presents base SAS software features and procedures.  It is intended for new users who have an introductory-level knowledge of SAS.

SAS Language and Procedures: Usage 2, Version 6, First Edition.  Task- oriented guide that presents base SAS software features and procedures.  It is intended for experienced users.

SAS Procedures Guide, Version 6, Third Edition.  Provides complete reference information for all procedures, including the new procedures.

SAS Language: Reference, Version 6, First Edition.  Contains complete reference information for all non-host-specific features of the SAS language.  Part 1 provides information about the DATA step processing and the SAS file structure.  Part 2 contains alphabetized information for individual features.  Part 3 outlines the SAS macro facility.  This book is intended for users with previous experience.

SAS Language and Procedures: Syntax, Version 6, First Edition.  Provides a quick but complete reference to the syntax for SAS software.

SAS Programming Tips: a Guide to Efficient SAS Programming.  Suggests more than 100 tips for improving the efficiency of SAS programs.

SAS Guide to the SQL Procedure: Usage and Reference, Version 6, First Edition.  Describes the Structured Query Language as implemented through the SQL procedure.

SAS Guide to Macro Processing, Version 6, Second Edition.  Provides a complete description of the SAS macro facility: macro variables, macro program statements, macro functions, DATA step interfaces and the autocall facility.

SAS Guide to Tabulate Processing, Second Edition.  Explains how to produce reports in tabular format with the TABULATE procedure.  It provides not only reference material, but also tutorial explanations, and sample applications.

SAS Companion for the CMS Environment, Version 6, First Edition.  Provides both usage and reference information about the SAS system under CMS.

SAS Companion for the MVS Environment, Version 6, First Edition.  Provides both usage and reference information about the SAS system under MVS.

SAS/STAT User's Guide, Version 6, Fourth Edition, Volume 1 and Volume 2.  Provides complete reference information in two volumes with the procedures listed alphabetically.

SAS/GRAPH Software: Usage, Version 6, First Edition.  Shows in a step- by-step format how to perform common graphing tasks.  This guides serves users who have a limited experience with SAS/GRAPH software.

SAS/GRAPH Software: Reference, Version 6, First Edition, Volume 1 and Volume 2.  Provides complete details for all features of SAS/GRAPH software.  Volume 1 includes sections on SAS/GRAPH programs, managing graphics output, global statements and the Annotate facility.  Volume 2 consists of reference chapters for each of the 23 procedures.

SAS/GRAPH Software: Syntax, Version 6, First Edition.  Provides a quick and complete reference to the syntax for SAS/GRAPH software.

SAS/IML Software: Usage and Reference, Version 6, First Edition.  Provides usage and reference sections which contain a complete syntax and language reference, as well as a tutorial.

SAS/ETS Software: Users's Guide, Version 6, First Edition.  Explains the 14 procedures in SAS/ETS software.

SAS/ETS Software Application Guide 1, Version 6, First Edition.  Is a task-oriented usage guide that shows you how to use SAS/ETS software for analyzing and forecasting time series data.


The following SAS manuals are available from the SAS Series in Statistical Applications:

SAS System for Elementary Statistical Analysis.  Teaches how to perform a variety of data analysis tasks and interpret the results.  Topics include comparing two or more groups, simple regression and basic diagnostics, as well as basic DATA steps.

SAS System for Linear Models, 1986 Edition.  Provides information about features and capabilities of the GLM, ANOVA, REG, MEANS, TTEST, and NESTED procedures.

SAS System for Regression, 1986 Edition.  Illustrates simple and multiple regression with a wide variety of examples.  It also covers polynomial models, log-linear models, non-linear models, spline functions and restricted linear models.

SAS Institute also publishes numerous technical reports.  For an up-to-date list of available technical reports, prices, and ordering information, interested persons should consult the current issue of SAS Communications, available for reference at ARDC; subscription inquiries should be addressed to SAS Institute Mailing List, Box 8000, Cary, NC 27511.

The SAS User's Group International (SUGI) meets annually.  Conference proceedings are available for reference at ARDC and may be purchased through SAS Institute (for current prices consult SAS COMMUNICATIONS).

SAS Institute Training

SAS Institute offers training courses on numerous SAS topics throughout the year.  SAS Institute also offers a variety of training packages for instructor-based, video-based, and computer-based educational programs.  Persons interested in registering for SAS courses or in ordering SAS courseware products should consult the current issue of SAS COMMUNICATIONS for schedules, descriptions, costs, and registration/ordering blanks.  Information is also available from the SAS Institute Training page:

Related ARDC Documents & Training

Following are other documentation available from Academic Research and Data Center of USC which deal with SAS-related topics:

BMDP - Documents the SASBMDP procedure for using SAS to access BMDP.

SASINST612 - Installations instructions for SAS 6.12 for Windows.

SASINST81 - Installations instructions for SAS 8.1 for Windows.

SASLICMAC - Updating SAS Licensing Information for Mac.

SASLIC612 - Updating SAS 6.12 Licensing Information for Windows.

SASLIC81 - Updating SAS 8.1 Licensing Information for Windows.

SASPROCS - Lists enhancements and new procedures in SAS 8.1.

SASY2K - SAS and Y2K Information

JCL - Documents the use of Job Control Language for submitting batch jobs.

SUBMIT - Documents the procedures for submitting batch jobs from CMS.

PCSAS - Documents SAS modules available under USC site license for DOS, Windows, OS/2 and Macintosh Operating Systems, and describes ordering procedures.


In addition to these documentations , Academic Research and Data Center has available the following other SAS-related document:

SAS Usage Notes - Lists known problems in SAS and useful tips for dealing with common difficulties encountered by SAS users.

In addition to these publications, ARDC offers regular short courses in SAS.  Shorter presentations on special topics can be scheduled upon request.  For information on the next regularly scheduled short course, series interested persons should contact the Academic Research & Data Center at 777-6865.

SAS Utilization on MVS (BATCH)

Following is the basic Job Control Language (JCL) needed for running SAS Version 6.09 in regular batch mode on the USC system:


          JOB statement
     // EXEC SAS6
          Optional DD statements
     //SYSIN DD *
          SAS program statements
     //

Following are examples of optional DD statements used in executing SAS batch jobs.  For a more involved explanation of the DD statements listed in this document, consult the JCL documentation for an explanation of DD statements and parameters.


Following are examples of DD statements for a variety of functions:

1. Reading raw data from a disk storage data set named N123456.DATASET:


     //FILEIN DD DSN=N123456.DATASET,DISP=SHR
NOTE: The DD name (FILEIN in this example) must match the name on the SAS INFILE statement.


2. Reading raw data from the first file on a standard-label, cartridge tape with a serial number of 456789:


     //TAPEIN DD DSN=N123456.TAPEFILE,UNIT=CTAPE,
     // VOL=SER=456789,LABEL=(1,SL),DISP=SHR
NOTE: The DD name (TAPEIN in this example) must match the name on the SAS INFILE statement.


3. Outputting a SAS file called N123456.SASFILE (requiring approximately 7 tracks) to disk storage (1 track on disk storage equals 56,664 bytes):


     //OUTFILE DD DSN=N123456.SASFILE,
     // UNIT=DASD,DISP=(NEW,CATLG,DELETE),
     // SPACE=(TRK,(7),RLSE)
NOTE: No DCB information should be coded.  The DD name ( OUTFILE in this example) must match the first part of the two-part name for the output file.


4. Outputting a SAS file called N123456.SASFILE as the second file on a standard-label cartridge tape with serial number 456789:


     //OUTFILE DD DSN=N123456.SASFILE,UNIT=CTAPE,
     // VOL=SER=456789,LABEL=(2,SL),DISP=(NEW,CATLG,DELETE)
See note for Example 3.


5. Reading the SAS file, N123456.SASFILE from disk storage:


     //IN DD DSN=N123456.SASFILE,DISP=SHR
NOTE: The DD name (IN in this example) must match the first part of the two-part name used to read it.


6. Reading the SAS file, N123456.SASFILE from the second file of a standard-label cartridge tape with serial number 456789.


     //INTAPE DD DSN=N123456.SASFILE,UNIT=CTAPE,
     // LABEL=(2,SL),VOL=SER=456789,DISP=OLD
See Note for Example 5.


7. Outputting raw data in card image to a disk storage data set called N123456.OUTSAS, allocating approximately 14 tracks:


     //OUTFILE DD DSN=N123456.OUTSAS,UNIT=DASD,
     // DCB=(LRECL=80,BLKSIZE=9040,RECFM=FB),
     // SPACE=(TRK,(14,1),RLSE),DISP=(NEW,CATLG,DELETE)
NOTE: The DD name (OUTFILE in this example) must match the the name on the FILE statement used to create it.


8. Outputting raw data to paper:


     //OUT DD SYSOUT=A

9. Produce ten copies of printed SAS output without getting multiple copies of the JCL and messages:

     //SASLIST DD SYSOUT=A,COPIES=10
NOTE: The SASLIST DD statement is not normally coded in the JCL because it is part of the cataloged SAS procedure.  The effect, when used as in this example, is to override the DD statement in the cataloged procedure.  This DD statement should follow the EXEC statement and precede the SYSIN DD * statement.

When running SAS jobs there are two aspects of space to consider:  workspace and memory.  Workspace is the amount of temporary disk space needed to store SAS data sets while the SAS job is running.  Memory is the CPU REGION required to execute the job.

The amount or workspace a job will require depends on such factors as the size of the data set read into SAS, the number of new variables created in the job, whether the data set is sorted during the job, the number of times it is subset, etc.  By default workspace is set at 12 cylinders of primary allocation and 5 cylinders of secondary allocation.  If there is not enough workspace, SAS issues the following message:

ERROR:  3. DATA SET WORK.#DIRCKPT REQUIRES MORE SPACE THAN
           IS AVAILABLE WITHIN THE SAS DATA BASE, DSN=XXX.
           THE  ALLOCATION  SPECIFIED  BY   THE  //WORK DD
           STATEMENT  SPACE  PARAMETER  (OR THAT USED WHEN
           THE  DATA  SET  WAS  FIRST ALLOCATED) IS INSUF-
           FICIENT. THE DATA SET CONTAINS 1 EXTENT, AND NO
           SECONDARY ALLOCATION IS POSSIBLE.
To increase workspace, override a JCL statement in the cataloged SAS procedure by adding the following statement after the EXEC statement and before the FT12 statement, if used:

   //WORK DD SPACE=(CYL,(xx,yy))
Replace "xx" and "yy" with the primary and secondary allocations. Version 6 of SAS requires at least 4096K of REGION.  If you specify less REGION on the JOB or EXEC statements of the SAS job, it will not execute.

If a job abends due to insufficient REGION, SAS issues a message indicating that more memory is needed to complete the task, and suggests an amount to use.  To increase memory to the required amount, use the REGION parameter on the JOB statement to specify the required amount. For example, REGION=6000K.

Reading Version 5 SAS Datasets and User-Defined Libraries

Conversion from Verion 5 SAS datasets to Version 6 SAS datasets can be accomplished in one of three ways:
    1) using the DATA step,
    2) using PROC COPY, or
    3) using PROC V5TOV6.
 Examples of each of these conversion techniques is documented below.


Example Using the DATA Step

Read a Version 5.18 SAS dataset named OLD which is a member of a SAS library and create a temporary, Version 6 SAS dataset named NEW.


     // EXEC SAS6
     //IN DD DSN=N123456.SAS5.LIBRARY,DISP=SHR
     //SYSIN DD *
     DATA NEW;  SET IN.OLD;
     //
NOTE:  The ddname in the DD statement defining the SAS dataset (IN in this example) must match the first part of the two-part name of the SET statement.


Example Using PROC COPY

Convert the Version 5 datasets ONE and TWO in the SAS library N123456.SAS5.LIBRARY to a Version 6 library named N123456.SAS6.LIBRARY.  This dataset requires 5 tracks of disk storage.


     // EXEC SAS6
     //INFILE  DD DSN=N123456.SAS5.LIBRARY,DISP=SHR
     //OUTFILE DD DSN=N123456.SAS6.LIBRARY,
     // UNIT=DASD,DISP=(NEW,CATLG,DELETE),
     // SPACE=(TRK,(5),RLSE)
     //SYSIN DD *
     PROC COPY IN=INFILE OUT=OUTFILE;
     SELECT ONE TWO / MEMTYPE=DATA;
     //
NOTE:  The ddnames in the DD statements defining the input and output datasets (INFILE and OUTFILE in this example) must match the library references of the IN= and OUT= parameters.


Example Using PROC V5TOV6

Convert all SAS files in the Version 5 library N123456.SAS5.LIBRARY to a Version 6 library named N123456.SAS6.LIBRARY.  This dataset requires 5 tracks of disk storage.


     // EXEC SAS6
     //INFILE  DD DSN=N123456.SAS5.LIBRARY,DISP=SHR
     //OUTFILE DD DSN=N123456.SAS6.LIBRARY,
     // UNIT=DASD,DISP=(NEW,CATLG,DELETE),
     // SPACE=(TRK,(5),RLSE)
     //SYSIN DD *
     PROC V5TOV6 IN=INFILE OUT=OUTFILE;
     //
NOTE:  The ddnames in the DD statements defining the input and output datasets (INFILE and OUTFILE in this example) must match the library references of the IN= and OUT= parameters.

ARDC Documentation     ARDC Home Page     USC Home Page    

*SAS is the registered trademark of SAS Institute Inc., Cary, N.C. 27511, U.S.A.

This page updated December 3, 2002 by Amy W. Yarbrough, Academic Research and Data Center.
Copyright © 2000, The Board of Trustees of the University of South Carolina.
URL http://www.sc.edu/ardc/docs/sas.htm