(Rev. 3/22/2010)
Contents :
- Versions
- Packages
- Windows Installation at OSEDA
- Starting SAS on the Desktop
- SAS on AIX (UNIX)
- Starting Interactive SAS Sessions from AIX
- Running SAS in Batch (Background) Mode from AIX
- Documentation
- Setting up Your SAS Autoexec File
- SAS/Connect Setup
- SAS/Share Servers
- Getting Help
- Batch Submission Using Ultraedit
- Feedback
We no longer have or support Version 8 on either platform.
Back to top
This section is new and relatively untested. It is based on just two instances of doing the version 9.2 install - by Keith Jam
To install sas9.2 on your desktop proceed as follows:
c:\Progam Files\SAS\SASFoundation\9.2You may want to navigate to this directory and then create a desktop shorcut to the sas.exe file within it. That file is, of course, the sas program (version 9.2).
The command to start a SAS interactive X windows session
is
sas9 &
The "&" is used to specify a process that you want
to have run in background mode. It does not seem to make sense
that your interactive session should be run in background, but it turns
out this is the best way. It starts the interactive window session
as a new process and then frees up the window from which you issued the
sas9 command, so that you can use it to issue Unix commands while
your interactive session is running. Without the "&" that window
is still waiting for the sas9 command to complete and will not let
you enter more commands.
Back to top
cd ~/practiceThe tilde (~) is a Unix notation indicating the current user's home directory. Notice that foward slash separating directories in Unix rather than the backward slashes used in Windows. There are actually many other possible options that can be entered in the line that invokes SAS, but in most cases you will never need them. The first option must be the name of the file containing the program to be run. Notice that the ".sas" extension is implied. The -noterminal option tells SAS that there is no terminal associated with this session, which would seem to be implicit given that we are specifying to run from a SAS program file rather than starting an interactive session, but it turns out that when certain kinds of errors occur in such programs this option is needed to keep the SAS session from hanging. The trailing "&" specifies background mode and frees up your current window for entering other Unix commands while your session is running. If all you plan to do is wait for the SAS program to finish, then you can omit the & in the command.
sas9 first -noterminal &
When these batch SAS programs run, they create a log
file and, if you have any standard printed output, a listing file.
In the above example, running the program first.sas from the practice directory
would result in the creation of first.log and first.lst
files in that directory. (No first.lst file would be created if your
program did not create any output on the standard SAS print file; this file
is the batch equivalent of the Output window in interactive SAS sessions.)
You will, of course, need to have a tool for viewing the results of your
batch program. One easy, standard command for doing this is:
more first.log
You could also browse the log file in any editor (such as pico or vi) that
runs under Unix, or if you are an Ultraedit user, you can browse the log
file (as well as creating the .sas file program in the first place) using
the FTP features of that editor. This is our second favorite way of
doing batch SAS processing on Unix. The favorite way involves submitting
SAS jobs to the background from X-Windows SAS sessions and is too complicated
for this document. See the
author's paper
in the on-line Proceedings from SUGI 22 if interested.
XAPPLRESDIR=$HOME/$LOGNAME-app-defaults
export XAPPLRESDIR
XAPPLRESDIR=/u/john/john-app-defaultsNow you do not have to create the directory and copy the SAS file.
export XAPPLRESDIR
libname sasctlgs '/pub/sasctlgs/v9'; *<---this should already be defined in your autoexec.sas file---;
proc build c=sasuser.profile batch;
merge c=library.keydefs etype=keys replace; run;
*--need the following statement, run from Display Manager, to make them effective *immediately*--;
dm 'keys ; copy dmkeys; save; end';
After running this code you should be able to use the following keys on the keypad of your keyboard (NumLock should be on):
We have set up a special OSEDA-default autoexec file for both Windows and AIX. For Windows it is stored on the P: shared drive in the \sas9 directory, filename autoexec.sas. It currently contains the following statements (but you should always point to the current version of that file, not to these lines):
%let ourpath=%str(P:\SAS Tools); *--edited 10-29-07 after L: drive went away--;
*--Following 2 statements allow SAS to search for and make use of our standard SAS
permanent format library. Required because we have refs to these in many datasets;
libname sasctlgs v9 "&ourpath\sasctlgs"; *<==========Updated to v9 format catalog 10-08 !!==;
options fmtsearch=(sasctlgs sasuser library);
*--as of 1/05 the sampdata directory was empty--;
libname sampdata "&ourpath\sampdata" access=readonly;
*--the sysprint option syntax has changed for v7. The port spec not used (LPTx:)-;
*--options sysprint="HP LaserJet 8000 PCL 6";
*--Cannot get the sysprint option to work any more, but it should default OK-;
filename sasmacro "&ourpath\sasmacro";
options mautosource sasautos=(sasmacro sasautos);
filename sascode "&ourpath\sascode";
*filename copykeys "&ourpath\sascode\copykeys.sas";
**filename rlink '!sasroot\connect\saslink\tcpunix.scr';*--fix later-;
filename rlink 'p:\sas9\tcpunix.scr'; *--connects to a v9 session on AIX;
%let oseda=oseda.missouri.edu;
%let mcdc=mcdc2.missouri.edu; *--added 7-25-01-;
options comamid=tcp remote=mcdc noxwait noxsync; *--remote option changed from oseda to mcdc, 11-2-05-;
There are a number of things that this autoexec does
for you. Mostly it issues libname and filename statements
to define some key shared resource files. For example, it defines
the file rlink where it will find the special script file used to
connect to a remote Unix session using the tcp access method.
It references a number of files and directories stored in the special L:\SAS
Tools directory. This, of course, will not work for anyone trying to run
SAS from a location that does not have access to the OSEDA LAN, where the
L: drive lives. Those of you wanting to run SAS outside of this
environment are going to have to either make your own copies of these files/directories
and edit this autoexec file to reference the copies, or live without some
of the convenience/power features that the autoexec provides.
These can be summarized as follows:
For AIX SAS users the equivalent of the P:\sas9\autoexec.sas
file is stored in /mscdc/sascode/autoexec8.sas (on oseda - is anyone still running sas9 on this box?) and in /pub/sascode/autoexec9.sas
(on mcdc2 and any other future AIX boxes). These will be invoked
by default for any SAS startup. You can create your own personal autoexec.sas
file in your home directory as file autoexec.sas. Such a file should
include a %include statement referencing the default file, i.e. the SAS
statement:
%include '/pub/sascode/autoexec9.sas';
This autoexec provides the same kind of setup access
to the formats and macro libraries as the Windows version does.
Back to top
filename rlink clear;
filename rlink 'c:\tcpunix2.scr'; *<--or whatever you called
it when you saved it, above.; This also makes it much easier to run batch jobs that have
dynamic signon statements.
Back to top
While establishing a remote session via SAS/Connect is a good way to have access to data stored on remote Unix systems while having the benefits of the more user friendly Windows interactive environment, there are some drawbacks to using SAS/Connect. One of the most obvious is that you have to have an active userid in order to signon to the remote system. Another has to do with efficiency involved with the extra overhead of starting up all those remote sessions (which sometimes leave behind worthless SAS sessions and their temporary file allocations when something goes wrong and the remote link gets broken.) A good alternative for users who just want to be able to access data on those remote sites, but without the ability to actually run SAS code on the remote system, is to take advantage of something called a SAS/Share Network server. These are just instances of SAS that run on the remote machines as a service application (much like an ftp service). To use a SAS/Share server requires several things on the part of the SAS user running on a Windows (or even another Unix) client:
libname myname '/pub/data/pl9490' server=mcdc.servername sapw=sesame;Here, I choose my own libref ("myname") and I have to specify the path within quotes. As always, I have to specify the 2-part server name and (if required by the way the server was set up) a server access password (sapw). The first part of the server name corresponds to a macro variable which has been assigned the IP address of the server. So, for example, we have the SAS statement
%let mcdc=mcdc2.missouri.edu; libname sf1 server=mcdc.mcdcshr;Here, the name "sf1" is the pre-defined libref. It happens to point to the data directory /pub/data/sf12000 on the mcdc2 AIX box. But you do not need to know or code the path. All you need to know is what name we used when we created the pre-defined reference to it when the server was started. See the reference, below, to the actual SAS code file used to created these predefined data libraries.
In that same services file I also have the following two entries:
mcdcshr
8012/tcp #--SAS/Share server on mcdc2, public
mcdcshr2
8013/tcp #--non-public SAS/Share server on mcdc2
These lines allow me to access two other SAS/Share services running on the mcdc2.missouri.edu (Missouri Census Data Center machine at OSEDA). The first is a public server, the second a private one. To access any of these you will need to create the entries in your services file and you will need to know the access passwords for them. We will provide you with the access passwords we think you will need. For security reasons, they will be subject to periodic change and will not be published. We plan to create a separate document that will provide more detailed information about specific SAS/Share servers running on the oseda machines. In the mean time you can see the librefs that are pre-defined for our two key servers by viewing two members of the /pub/sascode library on mcdc2. The members are
No assistance will be given to anyone who is found to not
have access to the SAS Online Doc facility. Without that access, learning
or using SAS is virtually impossible. In many instances, our reply
to your question may simply be a URL pointing to the page in the online
doc that answers your question. Remember to RTFM -- Read the
Friendly Manual -- before asking for consulting help. If you ask "How
can I get proc print to print double spaced" the answer will be
file:/L|/SAS OnlineDoc v9/sasdoc/sashtml/proc/z0057825.htm
-- the page within the online doc describing the Print procedure.
Back to top
As an example of what this will look like, on my desktop the command used to start sas is:
C:\Program Files\SAS\SASFoundation\9.2\sas.exe -CONFIG "C:\Program Files\SAS\SASFoundation\9.2\nls\en\SASV9.CFG"-noicon -nosplash -batch -sysin %n . These
are 3 useful SAS system options for running a batch job (noicon, nosplash
and batch) followed by the critical "-sysin" option where you can specify
the name of the file containing the sas program that is to be run. In the
Ultraedit world the "%n" reference causes the name of the current file
to be inserted (without the ".sas" extension, which is implied.)
%p. This reference will cause UE to tell SAS to start from the
directory (path) associated with the file that is currently being edited.
This completes the configuring of this new "Invoke SAS in batch tool". To use it, you need to open the .sas file containing the program you wish to run in batch. Then click on the Advanced item on the toolbar. You should now see an extra item at the bottom of the dropdown menu -- labeled "sas8" (or whatever you entered in the "Menu Item Name" box while configuring.) Click on the new option and it should automatically save the current file and run the sas command that you specified, passing it the name of the current program file and path (working directory). A mini window will open up telling you that SAS is running and showing the name of the file being used. When the program completes, this window will close.
When the program completes you can view the resulting .log and .lst file (if any) using UltraEdit. Just select File-Open and pick these files out of the current directory. I.e. if you are running a program named test1.sas in the C:\mysaspgms directory, you should be able to view the file C:\mysaspgms\test1.log and/or c:\mysaspgms\test1.lst .
If there are errors in the program or if you need to run it again, you can do so by editing the .sas file and submitting the job again. If you still have the .log file open in UE, it will actually tell you that another program has modified this file and ask you if you want to reload it. This is very handy (although for some inexplicable reason it seems to only work part of the time.)
John BlodgettURL:
OSEDA (Office of Social & Economic Data Analysis)
626 Clark Hall -- University of Missouri
Columbia, MO 65211
PH: 573-884-2727 FX: 573-884-4635
e-mail: blodgettj@umsystem.edu
http://mcdc2.missouri.edu/jgb/sas9/usgnotes.html