Running the SAS Program in Batch Mode
Creating the Command File
- To run SAS in batch mode, the user must first create a text file
containing the necessary SAS commands by using an editor such as
ne, vi, or pico.
- The command file should be saved with the
.sas
extension. For example:
filename.sas
- For specific instructions on how to write a command file, please refer
to the SAS Syntax Page of this document.
Executing the Command File
- To run the command file, type
sas filename
from the > prompt. It is not necessary to add
the .sas extension; SAS assumes it's there.
- However, if the command file has another extension, such as
.prog, you will have to type the full filename.
For example: sas filename.prog
The LOG and LST Files
- After SAS performs the commands listed, it writes a LOG file which
provides information to the user about the SAS job, including error
messages and warnings, details about the time the computer took to run the
command file as well as the SAS data sets written. The listing file
(
filename.lst) contains the output of the statistical
procedures.
- The LOG file should be read before reviewing the output to
determine whether or not the analysis ran as expected. Correct any errors
in the command file and re-run it before examining the listing file.
- The output in the LST file should be carefully reviewed to verify
that the results are meaningful. A program which executes without
errors does not guarantee a correct or meaningful analysis .
- If SAS is run interactively, the LOG and LST files appear on the
screen automatically.
- If SAS is run in batch mode, the LOG and LST files can be viewed
using the
more command at the > prompt. For example:
more filename.logmore
filename.lst
- Alternatively, the LOG and LST files can
also be read using a text editor.
Running the SAS Program Interactively
Users who run SAS interactively should have access to an XWindows
Interface and a high speed connection.
When SAS is run interactively, two computers are involved:
the server, which performs the SAS commands, and the client, which
displays the results of the SAS commands. Because the server and the
client do not automatically communicate, it is necessary for the user to
set the permissions so that the SAS commands can be entered to the server
and the output can be viewed on the desired client.
-
The server needs to know which client will display the
output of the SAS job. Usually, this is set automatically if you have
connected using ssh. It should not be necessary to change the DISPLAY
setting in this case.
- The client needs to know that it will be receiving
information from the server running SAS. This is done by giving the
xhost, command on the local machine. To run SAS interactively
on u.arizona.edu from, say, bogus.ccit.arizona.edu, you will need to
give the xhost command on the client (i.e., on bogus.ccit.arizona.edu):
xhost +u.arizona.edu
You can determine the name of the host node by typing "hostname" at the
prompt.
- Once the permissions have been set, SAS can be run interactively simply
by typing
sas
at the >
prompt. If you are not logged in with a high-speed connection (ethernet,
DSL, broadband, or cable modem), the window will take a long time to
display. In this case, it is more efficient to put your commands into a
file and run in non-interactive mode.
- NOTE: the permissions need to be set prior to running SAS,
and only need to be set once per SAS session.