SAS primarily is a statistical package, but it also performs many other functions. SAS functions include (but are not limited to)
The current version of SAS is SAS 9.2. See the SAS documentation for SAS 9.2 to see a long list of new features.
Where Can I Use sas on Campus?
SAS version 9.2 is available on the Central UNIX machine, strauss.
Be sure your configuration files on strauss conform to the current standard configuration. This can be done by executing a configuration script from the strauss command prompt.
Using a UNIX editor such as pico, vi, emacs
, add the following
two lines to a file in your home directory named .Xdefaults
.
SAS.webBroswer: /usr/local/bin/firefox-launcher SAS.helpBrowser: /usr/local/bin/firefox-launcher
If your .Xdefaults
file already contains SAS settings, put these
two lines after the last existing setting. If you do not have an
.Xdefaults
file, create it by specifying it as the file
name on an editor command. First go to your home directory by typing
cd
with no argument, for example --
cd pico .Xdefaults
Add the two lines above, save the file and exit.
These instructions divide into five subsections. They are
Using the SAS Display Manager System (DMS)
Using command files (batch)
Using SAS in line mode
Working with Permanent SAS data sets
Controlling the SAS Environment
There are three ways to run SAS
The first three subsections explain how to use these three methods.
The DMS is not available unless you are running software that supports full graphical UNIX X applications. These include the UNIX Sun Ray machines, a Windows machine running Xming, Cygwin, or Exceed, or a MAC running OS X.
To access strauss with full-screen interface from a Windows machine using secure shell --
If "Tunnel X11 connections" was not already checked, check it, save the settings and close secure shell.
If secure shell is already set to support tunneling, you need just the last two steps.
Note: Xming and Cygwin, are open-source software. You can install them free of charge on your personal computer. Exceed is not open source; it may, however, be installed at some of the puclic computing sites.
On a Sun Ray, you may start SAS with mouse clicks. Select
. You also may start SAS from a command prompt in an xterm window open on strauss.On a Sun Ray, you may open an xterm window on strauss by selecting Applications/Internet/xterm on Strauss. On Mac running OS X, logon to strauss. On a Windows machine, start Xming or Cygwin and logon to strauss with secure shell. With a connection from Windows, you may start sas from the secure-shell command prompt or from an xterm window.
To start SAS with a command, from a strauss command prompt, type --
sas
With this command, your terminal window is "frozen" until you exit SAS. To run interactive sas and free your terminal window for typing UNIX commands, add an ampersand after the SAS command.
sas &
When you start SAS with the Display Manager System, several windows appear. They look something like Figure 1, which is slightly modified and chopped on the right to fit into the figure.
Figure 1 |
As shown in Figure 1, three primary windows plus the Toolbox are visible. The three primary windows are
The SAS ToolBox is the narrow window at the bottom of the figure. It
can be used for quick access to several operations using the mouse, and
DMS commands may be typed in the dialog box. For instance, type
endsas
to exit SAS quickly with no dialogs. But be careful,
you are not prompted to save any files.
Additionally, two windows are hidden
Use the mouse to move and resize these windows. Each window is independent of the others and may be moved and resized to suit your preferences.
To obtain a spreadsheet window with limited data analysis
capability, select analyst
in the
ToolBox. The resulting window looks like Figure 2.
Figure 2. |
To bring in a file for analysis, click the "File" button. To open a file by its sas name (libref.name), select "Open By SAS Name."
Note: If you run a binary logistic regression using the
1
; the default is
0
which reverses the sign expected by most analysts.
To run the Windows version of SAS in the RDMS Lab, click
at the bottom left of the screen, select then ."If you have a small amount of data, it sometimes is convenient to
include it with your commands in the Program Editor. This example
shows how to read data from the Program Editor and produce descriptive
statistics. Note that the commands beginning with an asterisk
(*
) [and ending with a semicolon (;
)] are
comments. The complete program is --
To submit the program, select F3 key. Your program code disappears from the Program Editor. To retreive it, select or press the F4 key.
from the menus or press theAn annotated version of your program code is written into the SAS Log window. The Log window also contains notes, warnings and error messages. Output from procedures is written to the Output window. You can activate these windows by clicking on them or by selecting
from the menus and releasing on the window you wish to activate.For a small amount of output like that produced by this program, go straight to the Output window to view it. When you produce a large quantity of output, you may want to use the Results Window to navigate through it. The Results Window looks like --
Open each section marked by +, then right-click the ouput you wish to veiw and release on Open.
Usually it is more convenient to store data in an external text
file and use an infile
statement to identify the data to
SAS. A program illustrating how to do this is --
The datalines
statement, data and trailing semicolon
(;
) are replaced by the infile
statement.
Editing with the SAS Program Editor requires use of the prefix area
to delete and insert lines. For example, to delete the datalines
statement, the data and the trailing semicolon from the first example,
place DD
in the prefix area beside the first and last lines
to be deleted. --
When you press the ENTER key, the lines are
deleted. To insert a line, place an i
beside the line
before which you want the new line. When you press ENTER, a new line opens just below the line where
you placed the i
. Other useful line codes include
c
(copy one line), cc
(copy a block of lines
enclosed by cc
), b
(paste the copied line(s)
before the current line, a
(paste the copied line(s) after
the current line.
A convenient alternative to using the SAS Display Manager System
(DMS) is to place the commands you wish to execute in a text file and
execute SAS using the name of this command file as an "argument" to the
sas
command. For example, suppose your command file is
named dataprep.sas
, then you can run the SAS job by
typing either one of these two commands at the strauss prompt --
sas dataprep sas dataprep.sas
More generally, run a batch job by typing --
sas <command_file>
at the strauss prompt. Substitute the name of your command file for
<command_file>
. As illustrated above,
you may omit the extension if it is .sas
.
You may use a UNIX editor to create a file containing the commands you
want SAS to execute. For example, to use the
pico editor to create a command file called dataprep.sas
,
type
pico dataprep.sas
at the unix prompt. Type the SAS commands you want to execute and save the file.
Then run sas with dataprep.sas
as the command-line argument, as
just illustrated, e.g.
sas dataprep
For this example, an annotated copy of your commands is written to the
SAS log file called dataprep.log
, and results of SAS
procedures are written to the SAS listing file called
dataprep.lst
. You may view these two files on the
screen with the UNIX pager program called more
. To view
the output type
more dataprep.log more dataprep.lst
at the UNIX prompt.
In general, an annotated copy of your SAS commands are written to the
SAS log. The the name of the SAS log is formed by using the root
part of your command file name and log
as the extension.
Similarly, the name of the SAS listing file is formed by adding an
extension of lst
to the root part of the name of your
command file.
A convenient way to run batch SAS jobs is to open your command file
(.sas
) in pico
(or other editor) in one
terminal window. Save changes without exiting pico
. Run
the SAS job in another terminal window and view the output there, or in
a third window. You then can look at error messages in the saslog file
beside your syntax and make needed changes while viewing the error
messages. Also, to view different parts of your output side-by-side,
open two or more
terminal windows and view the file in
each one using a pager such as more
or
less
.
Note the analogies between the files used in SAS batch runs and the interactive SAS using the DMS --
Batch | DMS |
---|---|
command file, extension .sas |
Program Editor Window |
saslog, extension .log |
SAS Log Window |
sas listing, extension .lst |
SAS Output Window |
To print these files at the Smith Hall network printers, type
qpr -q smips dataprep.log qpr -q smips dataprep.lst
You should print both the log and listing files and keep them together, so you can check to see what commands generated the output.
To print the files somewhere besides Smith Hall, substitute the name of
the local printer queue for smips
. Printer queue names are posted at
computing sites. Or you can find them
online.
This example repeates Example 1a, except with a batch-SAS run instead of an interactive session. Note that batch SAS runs from any terminal, such as secure shell. You do not need a graphical X-window interface such as a Sun Ray, Windows computer running Xming, Cygwin or MAC with OS X. Also, batch runs are not affected by a slow connection such as a telephone modem. Therefore, you can run SAS from off-campus without need to install specialiazed software such as Xming.
If you have a small amount of data, it is convenient to put it in the same file that contains your SAS commands. This example shows how to do that. Suppose the name of your command file is
income1.sas
and it you typed the following lines into it
options linesize=80 noovp; * Read data, set missing values for persinc *; data income; input gender race persinc; if persinc = 99 then persinc=.; datalines; 1 1 20 1 1 99 1 1 13 2 1 1 1 1 10 2 2 5 2 1 12 1 1 7 2 1 99 2 2 2 ; run; * Produce descriptive statistics *; proc means data=income; run;
using an editor such as pico
, vi
or
emacs
.
Note that the commands beginning with an asterisk (*
)
[and ending with a semicolon (;
)] are comments. The lines
beginning with data income;
and ending with
run;
read the data and produce a temporary SAS data set
called income
. The proc means
statement
produces the descriptive statistics. The means procedure reads the data
from the temporary SAS data set, income
.
The first statement in this command file is an options statement. In
this example, it instructs SAS to restrict the width of the output files
to 80 characters or less. The 80-character width prevents lines from
wrapping on a standard-width screen. The noovp
option
stands for no overprint. Without it, diagnostic messages in the sas
log output are not properly aligned and are therefore difficult to
read.
Note the use of the datalines
statement. It signifies
to SAS that the data start on the next line. The isolated semicolon
following the last line of data signifies the end of the data.
(datalines
is an alias for the cards
statement.)
To run the program in batch mode on UNIX, type
sas income1
at the UNIX prompt. The results are written to two files. The SAS log
is written to the UNIX file called income1.log
. The SAS
listing is written to the UNIX file called income1.lst
.
To view the output type
more income1.log more income1.lst
at the UNIX prompt. You can speed up the viewing by getting both
files at once and piping them into more
cat income1.l?? | more
The cat
command lists the files to the terminal screen,
by default. The pipe symbol (|
) redirects the output into
the pager, more
. This prevents the output from scrolling
by so fast you can't read it.
To print these files at the Smith Hall network printers, type
qpr -q smips income1.log qpr -q smips income1.lst
You should print both the log and listing files and keep them together, so you can check to see what commands generated the output.
To print the files somewhere besides Smith Hall, substitute the name of
the local printer for smips
. Printer names are posted at computing
sites. Or you can find them
online.
This example repeats Example 2a, except it uses a batch SAS run instead of an interactive session.
The name of the command file for this example is
income2.sas
It shows how to read data from an external data file and produce
descriptive statistics. Compared to Example 1b, this command file substitutes the infile
statement for datalines;
the data and the trailing
semicolon. The data are stored in the external file named
income.data
.
The new command file looks like
options linesize=80 noovp; * Read data, set missing values for persinc *; data income; infile 'income.data'; input gender race persinc; if persinc = 99 then persinc=.; run; * Produce descriptive statistics *; proc means data=income; run;
Note that statements beginning with an
asterisk (*)
[and ending with a semicolon
(;
)] are comments.
As in Example 1b, the first statement in this command file is an
options statement. In this case, it instructs SAS to restrict the
width of the output files to 80 characters or less. The 80-character
width prevents lines from wrapping on a standard-width screen. The
noovp
option stands for no overprint. Without it,
diagnostic messages in the sas log output are not properly aligned and
are therefore difficult to read.
The lines beginning with data income;
and ending with
run;
read the data and produce a temporary SAS data set
called income
. The proc means
statement
produces the descriptive statistics. The means procedure reads the data
from the temporary SAS data set, income
.
The data file is income.data
. It contains the same data
as the data included in the command file for Example 1b. Its contents
look like
1 1 20 1 1 99 1 1 13 2 1 1 1 1 10 2 2 5 2 1 12 1 1 7 2 1 99 2 2 2
To run the program type
sas income2
at the UNIX prompt. The results are written to two files. The SAS log file is
income2.log
and the SAS listing file is
income2.lst
To view these files on your screen, type
more income2.log more income2.lst
at the UNIX prompt. You can speed up the viewing by getting both
files at once and piping them into more
cat income1.l?? | more
The cat
command lists the files to the terminal screen,
by default. The pipe symbol (|
) redirects the output into
the pager, more
. This prevents the output from scrolling
by so fast you can't read it. The question marks after .l
are "wild-card" characters. Each question mark stands for any single
character. (Use an asterisk (*
) to stand for any one
or more characters.)
To print these files at the Smith Hall network printers, type
qpr -q smips income2.log qpr -q smips income2.lst
You should print both the log and listing files and keep them together, so you can check to see what commands generated the output.
To print the files somewhere besides Smith Hall, substitute the name of
the local printer for smips
." Printer names are posted
at computing sites. Or you can find them
online.
You can speed up working with batch SAS by openening at least two windows on
strauss and using some UNIX short cuts. In one window, open your command
file with pico
or other editor. Don't exit the editor when
you are finished typing commands or making modifications. Instead, save the
file while keeping the editor open. In pico
you can save
your file by pressing ^O
-- control key and the letter
O
simultaneously. You are prompted to verify the file name;
press ENTER.
Run the job in the other terminal window you have open on strauss. Suppose
your command-file name is dataprep.sas
, you can gang together
commands to run the job and view all the output into one line, like this
sas dataprep; cat dataprep.l?? | less
The semicolon on a UNIX command line separates one command from the next.
Using it allows you to execute more than one command from a single line. The
advantage of doing this here is that the next times you want to run the
same job and view the output you can use the UNIX repeat shortcut, double
explanation point -- !!
repeats the most recent command line
input.
This example pipes the contents of dataprep.log
and
dataprep.lst
into a UNIX utility pager named
less
. This pager is a little more convenient than the one
named more
referenced previously. It does not automatically
exit when you reach the end of the input. The automatic exit can be a real
nuisance when you want to go back through the file. It also supports easy
searches and precise positioning of the contents in the terminal windowz.
To maneuver through a file using less, use the following keys:
q | quit |
SPACEBAR, d | Down one full screen |
b | Back one full screen |
Down Arrow,
ENTER, j
|
Down one line |
Up Arrow, k
|
Down one line |
G | Go to bottom of the file |
g | Go to top of the file |
/<string> | Search forward for "<string>" |
?<string> | Search backward for "<string>" |
n | Repeat most recent search going in the same direction |
N | Repeat most recent search going in the opposite direction |
h | Help (q to exit help) |
-i | Toggle case sensitive. First use: ignore case differences in searches. Second use: honor case differences again. |
Keys on the same line in column 1 separated
by a comma are alternative keys for the same operation. You can go down
one screen by pressing the SPACEBAR or the
letter d
, for instance. Some connections to strauss may
not support use of the up and down arrows. If they don't work, use the
k
and j
keys, respectively.
The search operation is particularly fast, and repeating a search is even
faster. A useful technique is to set the flag to ignore cases in searches
(-i
) and search for ^error
, like this
/^error
SAS error diagnostics start in the first character (column) on a
line. Using the carrot character in the search indicates to ignore
errors that appear elsewhere, for example, in regression output. To
find the next error message, press the letter n
(lower
case).
If you want to look at two (or more) locations in a file at the same time,
open another terminal window on strauss and view the file in both (all) of
them using a pager like less
.
On UNIX, to use SAS in line mode, type the following command
sas -nodms
You may type commands at the prompt. Results are written to the screen
as soon as procedures execute. To exit, type endsas;
.
If you forget a semicolon on a previous line, just type it on the
current line. Similarly, if you have an open quotation mark and have
already pressed the ENTER key, just type the
closing quotation mark on the current line. The endsas
command will not work if you have a missing semicolon or an open
quotation mark.
Line-mode execution is useful only for quik checks that produce no
more than one screen full of output, for example to find the
probability of a standard-normal variable exceeding 3.25, type
sas -nodms
at the strauss prompt. The session (excluding
the initial notes) looks like --
strauss.udel.edu% sas -nodms 1? data; p=probnorm(3.25); run; NOTE: The data set WORK.DATA1 has 1 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.08 seconds cpu time 0.04 seconds 2? proc print; run; The SAS System 1 14:41 Monday, June 5, 2006 Obs p 1 0.99942 NOTE: There were 1 observations read from the data set WORK.DATA1. NOTE: PROCEDURE PRINT used (Total process time): real time 0.07 seconds cpu time 0.07 seconds 3? endsas; NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 12.26 seconds cpu time 0.26 seconds strauss.udel.edu%
There are important advantages to using permanent SAS data sets. These include faster execution and improved organization of your computing tasks. When working with large data sets, the faster execution often is very noticeable. The primary disadvantage is that a permanent SAS data set requires disk storage space.
This section explains how to (1) create a permanent SAS data set, and (2) how to access it in a different SAS session than the one which created it.
This summary explains how to use a SAS data step to create a permanent SAS data set. Many SAS procedures also can create SAS data sets as output. For example, the regression procedure can create an output data set containing the regression coefficients and other statistics, and it can create another data set containing information like predicted values, prediction errors, and confidence intervals for predicted values. In addition, the Output Delivery System (ODS) will produce a SAS data set containing any statistic tabled by any SAS procedure.
The SAS data step starts with a data statement. The syntax of the data statement for creating one data set is
data <dataset-name>;
Replace <dataset-name>
with a valid name
for the data set. (More than one output data set can be created by
listing more than one data-set name after the data
keyword, e.g. data dsone dstwo dsthree;
).
There are two types of syntax for the
<dataset-name>
:
<dataset-name>
with the
UNIX filename, enclosed in quotes, for example
data "income.sas7bdat";
The file extension must be sas7bdat
. Here the
connection between the SAS syntax and the UNIX filename is direct: A
UNIX file called income.sas7bdat
will be created or
replaced in your current working directory.
libname
statement and a libref on the
data
statement. The second method is not quite so
transparent; here is an example
libname survey '~/income_survey'; data "survey.income";
The libname
statement establishes a libref called
survey
. In this example, the libref,
survey
, becomes a synonym or alias for the UNIX directory
~/income_survey
which is a subdirectory of your home
directory. (~/
is shorthand for your home directory.)
For method (b), the syntax for the
<dataset-name>
must contain two parts,
separated by a period. The first part is the libref. The second part
is the SAS dataset name which also becomes the root part of the UNIX
filename.
Assuming the current working directory is ~/income_survey
for method 1, both methods for this example, produce a SAS dataset with
the UNIX filename
income.sas7bdat
in your directory named income_survey
.
Using method 2, SAS automatically adds the extension
(sas7bdat
) to the UNIX filename. This extension is
required for SAS to access the file. So if you use UNIX commands to
move or copy the file, be sure the new version retains the
sas7bdat
extension.
Note: The libref exists only during the current SAS session, but the UNIX filename is permanent.
Here are two complete examples, one using each of the two syntaxes for the file name.
Method 1:
data "income.sas7bdat"; infile 'income.data'; input gender race persinc; if persinc = 99 then persinc=.; run;
Method 2:
libname survey '~/income_survey'; data survey.income; infile 'income.data'; input gender race persinc; if persinc = 99 then persinc=.; run;
In both cases, the data step reads data from an ascii data file called
income.data
and creates a permanent SAS data set with a
UNIX filename of income.sas7bdat
. If the current working
directory for method 1 is ~/income_survey,
the SAS data
set for both methods resides in the UNIX directory
~/income_survey
.
As these examples illustrate, you may use either single or double quotes to contain a filename, but the quotes on each side of the filename must be the same.
There are several contexts for accessing an existing permanent SAS data
set. These include the data=
option on a SAS procedure
statement and set
and merge
statements in a
SAS data step.
In each context, give the name of the sas data set using one of the two formats described in the preceding subsection ( How to Create a Permanent SAS Data Set). Here are three examples, each showing both ways to identify the SAS data set name.
glm
(a) Enclose the UNIX file name of the SAS data set in quotes (current
UNIX working directory is ~/income_survey
)
proc glm data="income.sas7bdat";
(b) Use a libname statement and a libref
libname survey '~/income_survey'; proc glm data=survey.income;
In both of these examples, the UNIX file containing the SAS data set
resides in your directory ~/income_survey
, and the unix
file name is income.sas7bdat
.
set
statement.
(a) Enclose the file name of the SAS data set in quotes (current
UNIX working directory is ~/rainfall
)
data desert; set "rain.sas7bdat"; where annual < 10; run;
(b) Use a libname statement and a libref
libname rainfall '~/rainfall'; data desert; set rainfall.rain; where annual < 10; run;
In this example, the SAS data set name is
rainfall.rain
. The UNIX filename for
rainfall.rain
is rain.sas7bdat
. It
resides in your UNIX directory ~/rainfall
. The data
step creates a temporary SAS data set called desert
defined by regions with less than 10 inches of annual rainfall. No
permanent UNIX file is created by this program -- when the job
completes, the data set desert
is removed.
(a) Enclosing the file name of the SAS data sets in quotes
proc sort data="~/student_survey/data.sas7bdat" out=student; by schoolid; run; proc sort data="~/school_data/data.sas7bdat" out=school; by schoolid; run; data stu_sch; merge student school; by schoolid; run; proc glm; class schltype; model colplan = gpa schltype / solution; run;
(b) Using libname statements and librefs
libname student '~/student_survey'; libname school '~/school_data'; proc sort data=student.data out=student; by schoolid; run; proc sort data=school.data out=school; by schoolid; run; data stu_sch; merge student school; by schoolid; run; proc glm; class schltype; model colplan = gpa schltype / solution; run;
There are two permanent SAS data sets in this example. The first
referenced, student.data
, resides in your UNIX file
~/student_survey/data.sas7bdat
. The second,
school.data
, resides in your UNIX file
~/school_data/data.sas7bdat
.
Note that the directory name is part of the filename string enclosed in quotes using method (a). This is necessary in at least one of the two sort statements since only one directory can be the current working directory.
The two proc sort
statements read a permanent SAS data
set, sort it by schoolid
, and create a temporary SAS data
set, student
and school
. The data step
merges these two sorted data sets by schoolid
. The
statement, by schoolid;
, means that SAS makes sure that
the schoolid
on each student record matches the
schoolid
on the school record -- so school information
matched to students comes from the school the student attends. The
output of the data step is a temporary SAS data set called
stu_sch
which is deleted at the end of the SAS
session.
The following tabulation summarizes the examples in the preceding subsections.
Description | Example |
---|---|
SAS libname statement: | libname survey '~/income_survey'; |
SAS data statement: | data survey.income; |
SAS name for the data set: | survey.income |
SAS libref: | survey |
UNIX directory: | ~/income_survey |
UNIX filename: | income.sas7bdat |
root part of UNIX filename: | income |
extension part of the UNIX filename: | sas7bdat |
Reference by UNIX filename | data "income.sas7bdat"; |
This section is divided into three subtopics:
You may set SAS options in several places. Here are eight of them
options statement in a command file or submitted in an interactive
session
autoexec.sas
file in your current working directory
autoexec.sas
file in your home directory
command-line flag
SASV9_OPTIONS
environment variable
sasv9.cfg
in your current working directory
sasv9.cfg
in your home directory
.sasv9.cfg
in your home directory (hidden file)
SAS searches for the options in the order given and uses the first one it finds. However, if conflicting values are given in one location (e.g., the same config file), the last setting is used.
Some options are set before SAS initializes and cannot be changed during
the SAS session. Other options may be changed at any time. Any option
can be specified in a config file, on the command line or in the UNIX
environment variable, SASV9_OPTIONS
. These take effect
before SAS initializes. Only options that may change during a SAS
session can be specified elsewhere. The SAS documentation indicates where
each option can be specified.
For example, suppose you want the number of characters per line in the SAS log and SAS listing files limited to no more than 80 and want to prevent overprinting of characters in error messages. To do this only in your current job, place an options statement at the top of the command file
options ls=80 noovp;
The noovp
option stands for no overprint. It makes
error messages much easier to read and interpret when viewed on your
terminal screen. It also prevents bold printing of error messages when
the SAS log is printed on paper. But the noovp
option
is irrelevant in an interactive SAS session and has no effect.
To accomplish the same settings using command line flags and a command
file named dataprep.sas
, type
sas -ls 80 -noovp dataprep
at the UNIX prompt.
The syntax for setting a UNIX environment variable depends on the UNIX
shell you are using. Most users at the University of Delaware use the
csh
or tcsh
shell. The syntax for these two
shells is the same. Use the setenv
command. For example,
to set the linesize
and noovp
options,
type
setenv SASV9_OPTIONS '-linesize=80 -noovp'
at the UNIX prompt.
These settings remain in effect as long as the environment variable is
set with their values, generally for the duration of your UNIX session.
Environment variables also may be defined in a file named
.localenv
which is located in your home directory. Commands
in the .localenv
file are executed automatically when you
begin a UNIX session.
To apply these options to all your SAS programs, put the
options
statement in a file called
autoexec.sas
in your home directory, or place the
following two lines in a sasv9.cfg
file (or
.sasv9.cfg
) in your home directory:
-linesize 80 -noovp
For a complete list of SAS system options see the SAS Language Reference. A copy is online.
You also may execute SAS commands automatically at the beginning of
each SAS session by placing the commands in an autoexec file. The
autoexec file must be named autoexec.sas
and placed
in your current working directory or in your home directory. An
autoexec file in your current directory takes precedence over one in
your home directory.
For example, suppose you are using the 1972-2004 General Social Survey
data. You have made a subset of the data and placed it in a SAS data
set located in a subdirectory of your home directory called
gss4295
(4295 is the ICPSR study number). You wish to use
the libref method of referencing the data. You may place the following
libname statement in an autoexec.sas
file:
libname gss4295 '~/gss4295';
This will save you the trouble of typing the libname statement in all
your programs to analyze these data. For example, suppose you called
the SAS data set gsswork. Then you can read the data with the reg
procedure using following statement:
proc reg data=gss4295.gsswork;
If you want to access this file from several directories, put the
autoexec.sas
in your home directory. But if you will be
doing all your work with these data in one or two directories, put the
autoexec.sas
file only in the directory(ies) where you
will be doing the work.
Since you may include options statements in an
autoexec.sas
file, you may not need a
sasv9.cfg
file if you have an autoexec.sas file. The
autoexec is more general, in that you may include options and SAS
statements in it. But it is less general for specifying options.
You may customize resources such as colors, fonts, and whether to start the Display Manager (DMS) with the pmenu buttons or command lines. Many of the options may be set by selecting
after starting an interactive SAS session with the DMS, as shown in Figure 3.
Figure 3. |
A few options are noteworthy. The
Keys
option brings up a new window displaying commands to
which function keys and other keys are assigned. This window is a
useful reference for learning shortcuts around using the mouse. For
example, the F3 key, by default, submits the
SAS program currently in the Program Editor window. You may change the
key settings by typing the desired SAS DMS command beside a key name
and then saving from the file menu. The Turn All Menus
Off
option causes the DMS to display a command line instead of
the menus. You may type commands at the command line. Some users may
find the Toolbox
to be a nuisance. By default, it's
always on top. You can edit its behavior or turn it off from the
options menu.
If you need help quickly, you may call the IT Help Center at 831-6000 between 8 a.m. and 5 p.m., Monday through Friday. Or, you can submit a question through e-mail.
Last updated: Ocober 5, 2009
This page maintained by larryh.
Copyright © University of Delaware 2009.