Office of Information Technology
Academic & Distributed Services / Research Programs

Statistics Laboratory

Frequently Asked Questions on SAS on UMDD

NOTE: UMDD will be retired this fall. All accounts will be deactivated by September 1. Users who need assistance with migrating applications and/or data to other platforms should contact Dick Atlee at data03@umd5.umd.edu. Chip Denman is the main contact for issues related to SAS, SPSS, and other statistical routines, and he can be emailed at dd47@umail.umd.edu.


 

SAS in interactive mode on UMDD
SAS in non-interactive mode on UMDD
SAS reading an external data file
Saving a SAS dataset
Reading a SAS dataset
SAS libraries
Printing a saslog or listing
Printing a SAS graph
Writing a SAS transport format file
Writing a SAS transport tape
Reading a SAS transport format file
SAS reading a SPSS system file
More memory to run SAS
More disk space to run SAS


SAS in interactive mode on UMDD

This is the default mode. At the CMS "Ready" prompt, type simply "SAS". SAS Display Manager will show two windows - the LOG and PGM (Program Editor) windows. Place the cursor at line marked 00001 in PGM, enter the following prog:

         data;  
            input x y z;
         cards; 
         2 5 4 
         4 7 5
         4 5 7 
         8 6 8  
         4 5 2  
         proc corr;  
         proc reg;  
            model z = x y;  
         run;

Along the "Command ===>" line at the top of the PGM window, you can type any command listed below. Notations regarding these commands are on the right.

         command ===> log                Switch to the Log window 
         command ===> out                Switch to the Output window  
         command ===> submit             Run the SAS program in the PGM 
         command ===> recall             Bring back the SAS program just
                                         submitted
         command ===> file 'Fn Ft a'     Save the text in the window into
                                         the permanent CMS file 'Fn Ft a'
         command ===> include 'Fn Ft a'  Bring the permanent CMS file
                                         'Fn Ft a' into PGM window
         command ===> endsas             Terminate the SAS interactive
                                         session

In Interactive Mode, SAS offers access to a SAS on-line help file for SAS language. Type "help" on the command line of any windows will open the SAS Help window. Type "help" on the command line of the Help window will display more instructions on how you can use this extensive on-line SAS Help facility.

SAS in non-interactive mode on UMDD


Non-interactive mode is faster for reading big data files or tape files, or just for running a SAS program already debugged. Most SAS users on UMDD use non-interactive mode.

Suppose that you have used either the XEDIT text editor or the "file" command in SAS interactive mode saving a SAS program in the permanent CMS file REGR SAS A.

To run this SAS program non-interactively, at the CMS "Ready" prompt, just type:

        sas regr

The log and output generated by this run will be automatically sent respectively to permanent files REGR SASLOG A and REGR LISTING A. Errors often result in no LISTING output produced. You should always check your SASLOG for error and warning messages.

SAS reading an external data file

It is often more convenient to keep data in a separate file rather than including it in a SAS program. Suppose that the data is in the CMS file named REGR DATA A, a FILENAME statement will be needed to associate it with a file reference used in the INFILE statement:

         filename in1 disk 'regr data a';
         data regfile;   
            infile in1;   
               input x y z;  
         proc print;

in1 could be any valid SAS name not used anywhere else in your SAS program.

Saving a SAS dataset

The following SAS program reads the data from the file REGR DATA A and save a SAS dataset in REGR SASET A:

         filename in disk 'regr data a'; 
         data saset.regr;  
            infile in; 
               input x y z;  
         proc print;

Note that a two part name SASET.REGR is used in the DATA statement. After a successful run of the above program, the CMS file REGR SASET A is created in the permanent disk 'A'. This permanent SAS data set contains all the data in the file REGR DATA A, including names and formats associated with the variables. When REGR SASET A is read back in by the SET subcommand or DATA option in other SAS programs, variables names and formats need not be re-identified.

Reading a SAS dataset

These are two sample SAS programs using SET and DATA reaching the data saved in the SAS dataset REGR SASET A:

Sample program 1 :

         data regfile;  
            set saset.regr;    
         proc print;


Sample program 2 :

         proc print data = saset.regr; 
 

SAS libraries

SAS groups SAS files into SAS data libraries. Under CMS, this grouping is done by file type and file mode. Files with the same CMS file type are members of the same SAS data library if they are on the same minidisk or tape.

SAS version 6 has no problems accessing a SAS library with all SAS data sets created under a previous release of the SAS system.

However, errors occur in two common circumstances, when a LIBNAME statement tries to specify a SAS library but other different format CMS files with file type matching the library reference exist on the minidisk, and when a new SAS data set created by SAS version 6 has been putting into a SAS library containing sas data sets generated by a previous version of SAS.

In the first case, if you try to save a SAS set, SAS will not generate the set. A new library reference should be used to save the set.

In the second case, SAS generates the SAS data set, but the whole library will become unreadable to SAS. The SAS data set newly generated need to be discarded, the old SAS data sets are still usable as individual sets, or as members of a library, just use a new library reference to create the new SAS data set.

Printing a saslog or listing

After running SAS, you may wish to send the statistics output or the log to a printer. The CMS PRINT command sends a file to the IBM 3800 laser printer in A.V. Williams. To print the REGR LISTING A, at the "Ready" prompt, type:

          print regr listing a

To print the REGR SASLOG A, type:

          print regr saslog a(cc

The option cc instructs the PRINT command that REGR SASLOG A does not have the filetype reserved for a print file, but it is a print file, with a print control character at the beginning of each line.

Printing a SAS graph

To print a SAS graph, you need to save the SAS graph as a script file by these SAS statements:

       goptions device=ps300 nodisplay gsfmode=replace gsfname=scrip;
       filename scrip disk 'INCOMPIE PS A';  
                 
       (SAS statements to generate the graph here) 
          
       run;

The postscript file INCOMPIE PS A can be either sent to a printer by the CMS NETPRINT command:

       netprint (network printer name) incompie ps a  

or just FTPed to a diskette and be printed later with appropriate DOS commands (COPY, PRINT, NPRINT etc.)

 

Writing a SAS transport format file

Use SAS portable files if you are transporting files between different computers such as between UMDD and UNIX, between UMDD and PC.

The following SAS program writes out a portable file.

    data in1;   
       set set.file1;   
    libname out1 xport 'file1 xport a'; 
    proc copy in=in1 out=out1;    
       select in1;  
    run;  

where set.file1 is the sas data set of CMS name 'file1 set a' and 'file1 xport a' is the CMS filename of the transport file.

'file1 xport a' is a binary file of logical record length of 80 bytes.
FTP on our UNIX system or on your PC can GET this file without problems.

Writing a SAS transport tape

Use tapes to store SAS portable files if you are transporting huge files between different installations.

On UMDD, the following SAS program writes out a SAS portable file to a standard tape that SAS on most installations can read:

    cms mount pxxxxx as tap1(unl den xxxx ring;  
    cms tape rew;  
    cms filedef tapeout tap1(recfm fb lrecl 80 blksize 8000;
    cms filedef in1 disk Fn Ft Fm;   
    libname tapeout xport; 
    proc copy in=in1 out=tapeout export;  
    run; 
 

where pxxxxx is the tape number obtained when you register your tape,
den xxxx is the density of your tape, usually 1600 or 6250,
Fn Ft Fm is the sas data set to be transported.

 

Reading a SAS transport format file

The following SAS program can be used on most computer systems to read a SAS transport format file:

         libname trans xport 'XXXXX';  
         libname outlib 'YYYYY';     
         proc copy in=trans out=outlib;   
         run;

XXXXX should be replaced by the external filename of the transport format file on the receiving host,
YYYYY should be replaced by the disk mode or the directory where you send the SAS dataset.

On UMDD,
XXXXX is replaced by a three part file name, eg. 'xportfil por a'
YYYYY is replaced by the file mode letter, eg. 'a'.

On a PC or UNIX system,
XXXXX is replaced by the directory and file name, eg. '\dir\xportfil.por'
YYYYY is replaced by the directory for the output file, eg. '\mydir'
mydir should exist at the SAS run.

IMPORTANT NOTE: When you use FTP to send the SAS transport format file from another system to the UMDD as a binary file, the logical record length of this file should be of eighty columns on UMDD. If the record length of the transport file is larger than eighty, you should use the CMS TRANSMOG command to reset the record length of that file to eighty:

         transmog reblock Fn Ft Fm newFn newFt Fm (lrecl 80


Fn Ft Fm is the three part file name of the transport format file of logical record length larger than eighty.
newFn newFt Fm is the three part file name of the new file with record length reset to eighty.

SAS reading a SPSS system file


SAS reads a SPSS system file generated on the same system without any difficulty:

         filename in1 'spss syst a'; 
         proc convert spss=in1 out=frspssys.saset;   
         proc contents data=frspssys.saset;

 

More memory to run SAS

Some SAS runs require more memory than others. To increase the memory, type:

     
         define storage Xm   
         ipl cms  
 

X is a number between 4 and up to the maximum memory allowed to your account.

To find out what is the maximum memory you are allowed, type:

         macct listall

or if your account is a subaccount then type:

         uacct list  

For SAS runs that need more than the maximum memory allowed to an account, users should contact the Statistics Laboratory 301-405-6030. The Lab will determine how much memory will be necessary for your SAS runs.

 

More disk space to run SAS


Some SAS procedures require more disk space than others. If SAS fills your disk during a program run, SAS then usually halts execution. If SAS says your permanent disk A is full, you need to delete unneeded files on the A disk by using the ERASE command:

          erase Fn Ft a

If SAS still needs more space and you cannot erase any more files on your A disk, contact the Statistics Laboratory at 301-405-6030 to determine how much more space is needed, or if the use of a temporary disk will resolve the space problem.

Sorting is one of SAS procedures that just requires temporary space for scratch files. To create a temporary disk, use the TDISKcommand:

         tdisk Fm size

Fm is the disk mode of the temporary disk, this should be a letter not in use - type Q SEARCH to see what letters are being used size is the size in cylinders of the temporary disk requested.

After the temporary disk is created, direct SAS to use this disk for scratch files with SIODISK option on the SAS command. For example, you could specify C as the mode of the temporary disk and run your SAS program with these commands:

         tdisk C 50
         sas regr (siodisk=c

If you create a temporary disk and then use the DEFINE STORAGE command discussed earlier, you will lose access to the temporary disk. To regain access, you have to use the ACCESS command:

         access diskaddr c

where diskaddr is the disk address of the temporary disk. You can find this disk address by using the querry command:

         Q DASD

It is better to use DEFINE STORAGE before you create a temporary disk.


UM home | OIT | Academic & Distributed Services | Stat Lab

Updated 7/2/2001. Please send questions and comments to statlab@umail.umd.edu