Session umask is added to the list of UNIX commands cd, pwd,or setenv thatSAS checks before executing the SAS equivalent in a session when youuse the X command, X statement, CALL system
Trang 3Designed for users of SAS in the UNIX environment, this companion is a valuable reference tool This
documentation describes the features of the SAS
language and SAS interface that are available only on UNIX or that behave differently on UNIX than on other platforms You will learn basic X window concepts, how they relate to SAS, and how to use X resources to
customize your SAS session Additional topics include:
working in and customizing the SAS windowing environment
Trang 4disclosure of this software and related documentation by the U.S
government is subject to the Agreement with SAS Institute and the
Restricted Rights (June 1987)
restrictions set forth in FAR 52.227-19 Commercial Computer Software-SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513
1st printing, January 2004
SAS Publishing provides a complete selection of books and electronicproducts to help customers use SAS software to its fullest potential Formore information about our e-books, e-learning products, CDs, and hard-copy books, visit the SAS Publishing Web site at support.sas.com/pubs
or call 1-800-727-3228
SAS® and all other SAS Institute Inc product or service names are
Trang 5Other brand and product names are registered trademarks or trademarks
of their respective companies
Trang 6What's New
Trang 7New and enhanced features for Base SAS improve ease of use and SASperformance under the UNIX operating environment:
SAS for the AIX, HP-UX, and Solaris operating environments is64-bit only
SMTP (Simple Mail Transfer Protocol) is now the default mailhandler
Sharing files between UNIX and Windows has been simplified.Using the MODULE family of SAS functions and CALL routines,you can invoke a routine that resides in an external shared libraryfrom within SAS
Universal Printing is the new default printing mechanism SASdoes not support host printing functionality
Notes This section describes the features of SAS software
under the UNIX operating environment that are new
or enhanced since SAS 8.2
z/OS is the successor to the OS/390 operatingsystem Throughout this document, any reference toz/OS also applies to OS/390, unless otherwise stated
Trang 8Starting in SAS 9, SAS for the AIX, HP-UX, and Solaris operating
environments is 64-bit only Consequently, some SAS files (such as yourSAS catalogs) that were created in 32-bit releases of SAS cannot beread by the V9 engine You can read and write to your 32-bit SAS datasets, SAS/ACCESS views from Oracle or SYBASE, SQL views, or MDDBfiles from a 64-bit SAS session using CEDA However, you cannot
update these files For more information, see "Migrating 32-Bit SAS Files
to 64-Bit in UNIX Environments" on page 106
You can use the MIGRATE procedure to convert all of your SAS files to64-bit For more information about the MIGRATE procedure, see theMigration Community at support.sas.com/rnd/migration
Note If you use Remote Library Services (RLS) to access SAS files
on a server, see the SAS/CONNECT User's Guide for
information about accessing Version 6 SAS files
Trang 9On the 64-bit AIX, HP-UX, and Solaris platforms, the V6 and V6TAPEread-only engines provide read-only access to your Release 6.12 data
sets See SAS Language Reference: Concepts for more information
about the compatibility of V6 files with SAS 9.1
With the Tru64 and Linux platforms, you still have read and write access
to your Release 6.12 data sets For more information about compatibilityissues, see "Accessing SAS Files across Compatible Machine Types inUNIX Environments" on page 108
Trang 10Your site administrator can specify SAS system options for your site, aspecific group, or an individual user in a restricted configuration file Because these options are restricted, you cannot change the specifiedvalue Use the new RESTRICT option in the OPTIONS procedure to seeall the system options that have been restricted For more informationabout how SAS processes the restricted configuration file, see "Order ofPrecedence for SAS Configuration Files" on page 17 For information
about creating a restricted configuration file, see the SAS System
Configuration Guide for UNIX.
Trang 11Session
umask is added to the list of UNIX commands cd, pwd,or setenv thatSAS checks before executing the SAS equivalent in a session when youuse the X command, X statement, CALL system routine, or %SYSEXEC.For more information, see "Executing a Single UNIX Command" on page13
Trang 12The default mail handler is SMTP (Simple Mail Transfer Protocol),which supports attachments For more information, see
"Initializing Electronic Mail" on page 144
The new BCC option in the FILENAME statement enables you tosend blind copy e-mails during a SAS session For more
attach the contents of a non-text window to your e-mail.Examples of non-text windows include a graph
generated by SAS/GRAPH and an image in your PROCREPORT output For more information, see "Sending theContents of a Non-Text Window" on page 49
Trang 13Accessing Shared Executable Libraries From SAS
Shared libraries in UNIX contain executable programs that are written invarious programming languages These libraries store useful routinesthat might be needed by many applications Using the MODULE family ofSAS functions and CALL routines, you can invoke a routine that resides
in an external shared library from within SAS You can access the sharedlibrary routines by using a DATA step, the IML procedure, and SCL code.See Chapter 7, "Accessing Shared Executable Libraries from SAS," onpage 169
Trang 14The cleanwork command can now be used to delete utility directorieswhose associated SAS process has ended For more information, see
"cleanwork Command" on page 400
Trang 15The SAS.useNativeXmTextTranslations X resource
specifies whether any XmText widget translations are inherited byall instances of the Text, Combo Box, and Spin Box widgets thatare used by the SAS X Motif user interface For more information,see "Miscellaneous Resources in UNIX Environments" on page96
The SAS.webBrowser resource is no longer supported TheSAS.helpBrowser resource now specifies the pathname of theWorld Wide Web browser for use when viewing the online help orwhen the WBROWSE command is issued For more information,see "Miscellaneous Resources in UNIX Environments" on page96
The following resources that were used to control your ODS
results are no longer supported:
SAS.resultsHTMLSAS.resultsUseWorkSAS.resultsTmpDirSAS.resultsHTMLStyleSAS.resultsListingSAS.resultsAutoNavigate
To set the values for your ODS output, use the Results tab in the
Preferences dialog box For more information, see "Modifying the ResultsSettings" on page 60
Trang 16"PEEKLONG Function" on page 254
Statements
The following option is new in the FILE, FILENAME, and INFILEstatements:
TERMSTR= enables the sharing of UNIX and PCformatted files
For more information, see "FILE Statement" on page 291, "FILENAMEStatement" on page 293, and "INFILE Statement" on page 299
The following options are new in the %INCLUDE statement:
Trang 17ENCODING= specifies the encoding to use whenreading from the specified source
procedure For more information, see "OPTIONS Procedure" onpage 279
The BMDP procedure is obsolete
System Options
The following system options are new:
You can specify the location of the Program Editorautosave file by using the AUTOSAVELOC systemoption For more information, see"AUTOSAVELOCSystem Option" on page 317
If you create a customized table of contents and index forthe SAS Help and Documentation, use the HELPINDEXand HELPTOC system options to specify the file location.For more information, see "HELPTOC System Option"
on page 335 and "HELPINDEX System Option" on page333
SSLCALISTLOC, SSLCERTLOC, SSLCLIENTAUTH,SSLCRLCHECK, SSLCRLLOC, SSLPVTKEYLOC, and
Trang 18on page 382
The following system options are enhanced:
If you specify only a directory path for the ALTLOG, LOG,ALTPRINT, or PRINT system options during SAS
invocation, then the default filename for your log or
procedure output file is filename.LOG or filename.LST, where filename is the name of your SAS job For more
information, see "ALTLOG System Option" on page 313,
"LOG System Option" on page 340, "ALTPRINT SystemOption" on page 314, and "PRINT System Option" onpage 351
SMTP (Simple Mail Transfer Protocol) is the new defaultfor the EMAILSYS system option For more information,see "EMAILSYS System Option" on page 326
V9 is a new value for the ENGINE system option Formore information, see "ENGINE System Option" on page327
MAX is the new default for the SORTSIZE system option.The value of MAX is based on your operating
environment For more information, see "SORTSIZESystem Option" on page 368
Trang 19Because the CoSort utility is no longer supported,cosort is not a valid value for the SORTNAME systemoption For more information, see "SORTNAME SystemOption" on page 367
The following system options are obsolete:
PROCLEAVESORTLIBSYSLEAVEXPRINTNM
The UNBUFLOG system option has been replaced by the LOGPARMsystem option, which is available in all operating environments For
details, see SAS Language Reference: Dictionary
Trang 20Part 1: Running SAS Software Under UNIX
Trang 22Chapter 1: Getting Started with SAS in UNIX Environments
Trang 23Invoking SAS
The command that you use to invoke your SAS session is defined duringthe SAS installation process and is added to the list of commands thatare recognized by the operating environment Ask your system
administrator what the command is that invokes SAS at your site At
many sites, the command to invoke SAS is simply sas, but a differentcommand might have been defined during the SAS installation process atyour site This documentation assumes that SAS is invoked by the sascommand
Note Before you start your SAS session, review the different
techniques for interrupting and terminating your SAS session(see "Interrupting or Terminating Your SAS Session in UNIXEnvironments" on page 22) Also, if you cannot stop your
session, contact your system administrator; do not turn off yourmachine, especially if your machine is part of a network
command line or in the configuration file), the SAS (or site-specific) default options are in effect
Trang 24specifies the name of the file containing the SAS program to beexecuted Specifying a filename on the SAS command invokes abatch SAS session Omit the filename to begin an interactivesession
If the file is not in the current directory, specify its full pathname
Example: Invoking an Interactive SAS Session
To invoke an interactive SAS session, without specifying any SAS systemoptions, enter
To run a SAS program and pass parameters to it, enter
sas -sysparm 'A B C' progparm.sas
The value A B C is assigned to the SYSPARM macro variable, whichcan be read by the program ProgParm.sas
What If SAS Does Not Start?
If SAS does not start, the SAS log might contain error messages thatexplain the failure However, error messages that SAS issues before theSAS log is initialized are written to the SAS console log
Under UNIX, the STDOUT fileref specifies the location of the console log
Trang 25Running SAS in a Foreground or Background Process
UNIX is a multitasking system, so you can run multiple processes at thesame time For example, you can have one process running in the
foreground and three in the background A foreground process executeswhile you wait for the prompt; that is, you cannot execute additional
commands while the current command is being executed After you enter
a command, the shell starts a process to execute the command After thesystem executes the command, the shell displays the prompt and youcan enter additional commands A background process executes
independently of the shell After you enter a command, the shell starts aprocess to execute the command and then issues the system prompt.You can enter other commands or start other background tasks withoutwaiting for your initial command to execute You can run SAS in the
foreground or in the background
Note Both the C shell and the Korn shell include commands that
enable you to move jobs among three possible states: running
in the foreground, running in the background, and suspended
Trang 27Environments
Introduction to the SAS Windowing Environment
You interact with SAS through windows using your keyboard, mouse,pull-down menus, pop-up menus, and icons The windowing environmentincludes, but is not limited to, the Explorer, Program Editor, Output, Log,and Results windows
Your SAS session may default to the windowing environment interface Ifyou want to use the windowing environment, you can start your SASsession as a foreground process or as a background process (by adding
Environments" on page 7
What is the Explorer Window?
Explorer is a windowing environment for managing basic SAS softwaretasks such as viewing and managing data sets, libraries, members,
applications, and output The SAS Explorer is a central access point fromwhich you can do the following:
manipulate SAS data through a graphical interface
access the Program Editor, Output, and Log windows (as well asother windows)
view the results of SAS procedure output in the Results windowimport files into SAS
Trang 28The Program Editor, Output, and Log windows enable you to edit andexecute SAS programs and display output For more information aboutthese windows, see SAS Help and Documentation
Invoking SAS in the Windowing Environment
You can use the following commands to specify which windows openwhen the SAS session starts
You can open the Explorer window by specifying the EXPLORERsystem option:
sas -explorer
You can open the Program Editor, Output, and Log windows byspecifying the DMS system option:
sas -dms
You can use the DMSEXP system option to open the ProgramEditor, Output, Log, and Results windows and the Explorer:
sas -dmsexp
SAS also opens the toolbox from which you can open additional SASwindows For more information about the toolbox, see to Chapter 2,
"Working in the SAS Windowing Environment," on page 29
Exiting SAS in the Windowing Environment
Trang 29File ▶ Exit
from the pull-down menu of the session that you want to end
Trang 30Introduction to Interactive Line Mode
You enter SAS statements line by line in response to prompts issued bySAS SAS reads the source statements from the terminal as you enterthem DATA and PROC steps execute when
Exiting SAS in Interactive Line Mode
You can end the session by pressing the EOF key (usually CTRL+D; see
"Using Control Keys" on page 23) or by issuing the ENDSAS statement: endsas;
Trang 31Introduction to Running SAS in Batch Mode
To run SAS in batch mode, you specify your SAS application name in theSAS command You can run batch mode in the foreground, in the
background by specifying an ampersand at the end of the SAS
command, or submit your application to the batch queue by using thebatch, at, nohup,or cron UNIX commands (For more information,refer to the UNIX man pages for the batch, at, nohup,or cron
commands.) If you start your application with one of these UNIX
commands and you log off of your system, then your application willcomplete execution If your application contains statements that start aninteractive procedure such as FSEDIT, then you need to run your batchapplication in the foreground
Invoking SAS in Batch Mode
To invoke SAS in batch mode, you must specify a filename in the SAScommand For example, if Weekly.rpt is the file containing the SAS
statements to be executed, and you want to specify the NODATE andLINESIZE system options, you would enter
sas weekly.rpt -nodate -linesize 90
The command would run the program in the foreground If you want torun the program in the background, add the ampersand to the end of thecommand:
sas weekly.rpt -nodate -linesize 90 &
You do not need to specify the SYSIN option as with some other
platforms
SAS creates a log file and a lst file in the current directory that containsthe log and procedure output
Trang 32To submit your program to the batch queue, you can use the batch, at,nohup, or cron commands For example, you could submit Weekly.rptfrom your shell prompt as follows:
$ at 2am
sas weekly.rpt
<control-D>
warning: commands will be executed using /usr/bin/sh job 8400.a at Wed Jun 11 02:00:00 2003
$
If you create a file that contains the SAS command necessary to run yourprogram, for example CmdFile.sas, then you can enter the following
command at your shell prompt:
at 2am < cmdfile.sas
SAS sends the output to a file that has the same name as the programand an extension of lst, and the log goes to a file with an extension of.log Both of these files are written to your current directory Refer to theman pages for these commands for more information on submitting jobs
to the batch queue For more details on routing output, see Chapter 6,
"Printing and Routing Output," on page 153
Note If your program contains statements that start an interactive
procedure such as the FSEDIT procedure, you will need to runyour program in the foreground
Writing Data From an External File using Pipes
You can use a pipe to write data from an external file to a SAS program.For example, suppose that your data resides in the file MyData and yourprogram MyProg.sas includes this statement:
INFILE STDIN;
Issue this command to have MyProg.sas read data from MyData:
Trang 33For details about using external files, see Chapter 5, "Using ExternalFiles and Devices," on page 131 See also "File Descriptors in theBourne and Korn Shells" on page 140 for another way to have a SASprogram read data from an external file
Trang 34Environments
Introduction to Running SAS on a Remote Host
When you invoke SAS in an interactive mode, you can run SAS on yourlocal host, or you can run SAS on a remote host and interact with thesession through an X server running on your workstation The serverprovides the display services that are needed for the X Window System.Most of the time, the server name is derived from the machine's name.For example, if your machine is named green, the name of the server isgreen:0.0 In most cases, the X server will already be running whenyou log in If you need to start your server manually, consult the
documentation that is provided with your X Window System software
To run SAS on a remote host, you must tell SAS which display to use byeither setting the DISPLAY environment variable or specifying the -display X command line option
Steps for Running SAS on a Remote Host
To run SAS on a remote host, follow these steps:
1 Make sure that the clients running on the remote host havepermission to connect to your server Most systems control this
by using the xhost client Other systems control access
through a session manager To use the xhost client to permitall remote hosts to connect to your server, enter the followingcommand at the system prompt on the system that is runningyour X server:
xhost +
To run this command automatically each time you log in, enterthis command in a file named xhost
If your system does not control access with the xhost client,
Trang 352 Log in to the remote system, or use a remote shell
3 Identify your server as the target display for X clients that arerun on the remote host You can do this in one of two ways:
a Set the DISPLAY environment variable In the Bourneand Korn shells, you can set the DISPLAY variable asfollows:
DISPLAY=green:0.0 export DISPLAY
In the Korn shell, you can combine these twocommands:
export DISPLAY=green:0.0
In the C shell, you must use the setenv command: setenv DISPLAY green:0.0
The DISPLAY variable will be used by all Xclients onthe system
Note To determine the shell for your system, type
ps at the command prompt or check thevalue of the SHELL environment variable
b Use the -display option For example:
sas -display green:0.0
If you have trouble establishing a connection, you cantry using an IP address instead of a display name, forexample:
-display 10.22.1.1:0
Note This option is a command line option for the
Trang 36X Window system, not for SAS Specifyingthis option in a SAS configuration file or inthe SASV9_OPTIONS environment variablemight cause problems when you are runningother interfaces.
Trang 37How to Specify X Window System Options
When you invoke some X clients, such as SAS, you can use commandline options that are passed to the X Window System In general, youshould specify X Window System options after SAS options on the
command line
Supported X Command Line Options
The following list describes the X command line options that are availablewhen you invoke a SAS session from the command prompt
-display host:server.screen
specifies the name or IP address of the terminal on which youwant to display the SAS session For example, if your displaynode is wizard, you might enter
SAS/GRAPH Reference, Volumes 1 and 2.
Trang 38server, unset the DISPLAY environment variable anduse the -noterminal option on the command line
-title string
specifies the title up to six characters long for your SAS sessionwindow To use multiple words in the title, enclose the words insingle or double quotation marks For example, -title MYSASproduces MYSAS:Explorer in the title bar of the Explorer
window
-xrm string
specifies a resource to override any defaults For example, thefollowing resource turns off the Confirm dialog box when you exitSAS:
-xrm 'SAS.confirmSASExit: False'
Unsupported X Command Line Options
SAS does not support the following X command line options becausetheir functionality is not applicable to SAS or is provided by SAS
resources Refer to "Overview of X Resources" on page 55 for moreinformation on SAS resources
-geometry
Window geometry is specified by the SAS.windowHeight,SAS.windowWidth, SAS.maxWindowHeight, and
Trang 39These options are ignored The width of window borders is set bySAS
This option is ignored
-reverse, -rv, +rv
These options are ignored Refer to "Defining Colors and
Attributes for Window Elements (CPARMS)" on page 88 for adescription of specifying reverse video
Trang 40Executing Operating System Commands From Your SAS Session
305 for information about executing commands asynchronously
When you execute one or more UNIX commands synchronously, then
you must wait for those commands to finish executing before you cancontinue working in your SAS session You can use the CALL SYSTEMroutine, %SYSEXEC macro program statement, X statement, and Xcommand to execute UNIX commands synchronously The CALL
SYSTEM routine can be executed with a DATA step The %SYSEXECmacro statement can be used inside macro definitions, and the X
statement can be used outside of DATA steps and macro definitions Youcan enter the X command on any SAS command line See "CALL
SYSTEM Routine" on page 239 and "Macro Statements in UNIX
Environments" on page 265 for more information
Executing a Single UNIX Command
To execute only one UNIX command, you can enter the X command, Xstatement, CALL SYSTEM routine, or %SYSEXEC macro statement asfollows:
X command
X command;
CALL SYSTEM ('command');
%SYSEXEC command;