49
Chapter 6 • Managing SAS Output under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Routing Procedure Output to a Web Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Routing Procedure Output and the SAS Log to a File . . . . . . . . . . . . . . . . . . . . . . . . . 188
Using the SAS Logging Facility to Write Log Messages . . . . . . . . . . . . . . . . . . . . . . . 190
Producing Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Chapter 7 • Performance Considerations under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Hardware Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Windows Features That Optimize Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
SAS Features That Optimize Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Network Performance Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Sasiotest Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Advanced Performance Tuning Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
PART 2
Using SAS with Other Windows Applications
213
Chapter 8 • Using Windows System Tools with SAS under Windows . . . . . . . . . . . . . . . . . . . 215
Introduction to Using Windows System Tools with SAS . . . . . . . . . . . . . . . . . . . . . . . 215
Event Viewer Application Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Performance Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Starting SAS as a Windows Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Chapter 9 • Using OLE in SAS/AF Software under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
About OLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
SAS/AF Catalog Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Inserting an OLE Object in a FRAME Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Editing an OLE Object within a FRAME Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Invoking OLE Verbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Using Linked OLE Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Converting OLE Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Automating OLE Objects and Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Using OLE Custom Controls (OCXs) in Your SAS/AF Application . . . . . . . . . . . . . . 251
Chapter 10 • Controlling SAS from Another Application Using OLE . . . . . . . . . . . . . . . . . . . . 259
Introduction to Automating SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Creating an Instance of SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Getting Feedback from the SAS Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Examples of Automating SAS with OLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Methods and Properties for Use with a SAS OLE Automation Object . . . . . . . . . . . . 262
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Chapter 11 • Using Dynamic Data Exchange under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Overview of Dynamic Data Exchange (DDE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
DDE Syntax within SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Referencing the DDE External File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
DDE Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Chapter 12 • Using Unnamed and Named Pipes under Windows . . . . . . . . . . . . . . . . . . . . . . . 279
Overview of Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Using Unnamed Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Using Named Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
iv
Contents
48
Chapter 13 • Accessing External DLLs from SAS under Windows . . . . . . . . . . . . . . . . . . . . . . 291
Overview of Dynamic Link Libraries in SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
The SASCBTBL Attribute Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Special Considerations When Using External DLLs . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Chapter 14 • Special Considerations for SAS/AF Programmers under Windows . . . . . . . . . . 313
Controlling the Appearance and Behavior of SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Controlling the Main SAS Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Accessing External DLLs from SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Designing, Saving, and Loading Custom Toolbar Controls . . . . . . . . . . . . . . . . . . . . . 318
Invoking SAS/AF Applications Automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Associating Your Own Logo and Icons with Your SAS/AF Application . . . . . . . . . . . 319
PART 3
Features of the SAS Language for Windows
321
Chapter 15 • Data Set Options under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
SAS Data Set Options under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Chapter 16 • SAS Commands under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
SAS Commands under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Chapter 17 • SAS Formats under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
SAS Formats under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Writing Binary Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Accessing User-Written Formats from Releases Earlier Than SAS 9.4 . . . . . . . . . . . . 378
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Chapter 18 • SAS Functions and CALL Routines under Windows . . . . . . . . . . . . . . . . . . . . . . 389
SAS Functions and CALL Routines under Windows . . . . . . . . . . . . . . . . . . . . . . . . . 389
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Chapter 19 • SAS Informats under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
SAS Informats under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Reading Binary Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Converting User-Written Informats from Earlier Releases to SAS 9.4 . . . . . . . . . . . . 420
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Chapter 20 • SAS Procedures under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
SAS Procedures under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Chapter 21 • SAS Statements under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
SAS Statements under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Chapter 22 • SAS System Options under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
SAS System Options under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Displaying SAS System Option Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Changing SAS System Option Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Processing System Options That Are Set in Several Places . . . . . . . . . . . . . . . . . . . . . 485
SAS System Options by Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Contents
v
48
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
Chapter 23 • Length and Precision of Variables under Windows . . . . . . . . . . . . . . . . . . . . . . . 607
Length and Precision of Variables under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Numeric Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Character Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
Chapter 24 • SAS Macro Facility under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
SAS Macro Facility under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
Automatic Macro Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
Macro Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
Macro Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
Autocall Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
PART 4
Appendixes
617
Appendix 1 • SCL Methods for Automating OLE Objects under Windows . . . . . . . . . . . . . . . . 619
Summary of OLE Class Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
Appendix 2 • Error Messages for SAS under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Overview of SAS Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Return Codes and Completion Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Accessing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Using SAS Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
Using OLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
Using Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
Resolving Internal Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
Resolving Operating System and Windows Error Messages . . . . . . . . . . . . . . . . . . . . 635
Initialization and Termination Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Appendix 3 • Graphics Considerations under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Appendix 4 • Default Key Settings for Interactive SAS Sessions under Windows . . . . . . . . . 639
Default Key Definitions under Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
Keyboard Shortcuts within the SAS Main Window . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Keyboard Shortcuts within the Enhanced Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643
Keyboard Shortcuts within Print Preview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Appendix 5 • Cleanwork Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Cleanwork Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Scheduling the Cleanwork Utility with Microsoft Task Scheduler . . . . . . . . . . . . . . . 650
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
Appendix 6 • Sasiotest Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Sasiotest Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Best Practices and Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654
Acceptable SAS I/O Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
Appendix 7 • Using EBCDIC Data on ASCII Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
About EBCDIC and ASCII Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
Moving Data from EBCDIC to ASCII Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
Moving Data from ASCII to EBCDIC Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
vi
Contents
5
Recommended Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
Contents
vii
30
About This Book
Syntax Conventions for the SAS Language
Overview of Syntax Conventions for the SAS Language
SAS uses standard conventions in the documentation of syntax for SAS language
elements. These conventions enable you to easily identify the components of SAS
syntax. The conventions can be divided into these parts:
• syntax components
• style conventions
• special characters
• references to SAS libraries and external files
Syntax Components
The components of the syntax for most language elements include a keyword and
arguments. For some language elements, only a keyword is necessary. For other
language elements, the keyword is followed by an equal sign (=). The syntax for
arguments has multiple forms in order to demonstrate the syntax of multiple arguments,
with and without punctuation.
keyword
specifies the name of the SAS language element that you use when you write your
program. Keyword is a literal that is usually the first word in the syntax. In a CALL
routine, the first two words are keywords.
In these examples of SAS syntax, the keywords are bold:
CHAR (string, position)
CALL RANBIN (seed, n, p, x);
ALTER (alter-password)
BEST w.
REMOVE <data-set-name>
In this example, the first two words of the CALL routine are the keywords:
CALL RANBIN(seed, n, p, x)
The syntax of some SAS statements consists of a single keyword without arguments:
ix
47
DO;
... SAS code ...
END;
Some system options require that one of two keyword values be specified:
DUPLEX | NODUPLEX
Some procedure statements have multiple keywords throughout the statement syntax:
CREATE <UNIQUE> INDEX index-name ON table-name (column-1 <, column-2, …>)
argument
specifies a numeric or character constant, variable, or expression. Arguments follow
the keyword or an equal sign after the keyword. The arguments are used by SAS to
process the language element. Arguments can be required or optional. In the syntax,
optional arguments are enclosed in angle brackets ( < > ).
In this example, string and position follow the keyword CHAR. These arguments are
required arguments for the CHAR function:
CHAR (string, position)
Each argument has a value. In this example of SAS code, the argument string has a
value of 'summer', and the argument position has a value of 4:
x=char('summer', 4);
In this example, string and substring are required arguments, whereas modifiers and
startpos are optional.
FIND(string, substring <, modifiers> <, startpos>
argument(s)
specifies that one argument is required and that multiple arguments are allowed.
Separate arguments with a space. Punctuation, such as a comma ( , ) is not required
between arguments.
The MISSING statement is an example of this form of multiple arguments:
MISSING character(s);
<LITERAL_ARGUMENT> argument-1 <<LITERAL_ARGUMENT> argument-2 ... >
specifies that one argument is required and that a literal argument can be associated
with the argument. You can specify multiple literals and argument pairs. No
punctuation is required between the literal and argument pairs. The ellipsis (...)
indicates that additional literals and arguments are allowed.
The BY statement is an example of this argument:
BY <DESCENDING> variable-1 <<DESCENDING> variable-2 …>;
argument-1 <option(s)> <argument-2 <option(s)> ...>
specifies that one argument is required and that one or more options can be
associated with the argument. You can specify multiple arguments and associated
options. No punctuation is required between the argument and the option. The
ellipsis (...) indicates that additional arguments with an associated option are
allowed.
The FORMAT procedure PICTURE statement is an example of this form of multiple
arguments:
PICTURE name <(format-option(s))>
<value-range-set-1 <(picture-1-option(s))>
<value-range-set-2 <(picture-2-option(s))> …>>;
x
About This Book
Documents you may be interested
Documents you may be interested