Contents
About
What's New in SAS/IML
New Features
Modules for Multivariate Random Sampling
Performance Improvements
ODS Statistical Graphics Interface
BSPLINE Function
Vector-Matrix Operations
GEOMEAN and HARMEAN Functions
New Related Software
Introduction to SAS/IML Software
Overview
SAS/IML Software: Highlights
An Introductory Interactive Session
PROC IML Statement
Understanding the Interactive Matrix Language
Defining a Matrix
Matrix Names and Literals
Matrix Names
Matrix Literals
Creating Matrices from Matrix Literals
Scalar Literals
Numeric Literals
Character Literals
Repetition Factors
Reassigning Values
Assignment Statements
Types of Statements
Control Statements
Functions
CALL Statements and Subroutines
Commands
Missing Values
Summary
Tutorial: A Module for Linear Regression
Overview
Solving a System of Equations
A Module for Linear Regression
Plotting Regression Results
Summary
Working with Matrices
Overview
Entering Data as Matrix Literals
Scalars
Matrices with Multiple Elements
Using Assignment Statements
Simple Assignment Statements
Matrix-Generating Functions
Index Vectors
Using Matrix Expressions
Operators
Compound Expressions
Elementwise Binary Operators
Subscripts
Subscript Reduction Operators
Displaying Matrices with Row and Column Headings
Using the AUTONAME Option
Using the ROWNAME= and COLNAME= Options
Using the MATTRIB Statement
More about Missing Values
Programming Statements
Overview
IF-THEN/ELSE Statements
DO Groups
Iterative Execution
Jumping
Module Definition and Execution
Defining and Executing a Module
Nesting Modules
Understanding Symbol Tables
Modules with No Arguments
Modules with Arguments
More about Argument Passing
Module Storage
Stopping Execution
PAUSE Statement
STOP Statement
ABORT Statement
Summary
Working with SAS Data Sets
Overview
Opening a SAS Data Set
Making a SAS Data Set Current
Displaying SAS Data Set Information
Referring to a SAS Data Set
Listing Observations
Specifying a Range of Observations
Selecting a Set of Variables
Selecting Observations
Reading Observations from a SAS Data Set
Using the READ Statement with the VAR Clause
Using the READ Statement with the VAR and INTO Clauses
Using the READ Statement with the WHERE Clause
Editing a SAS Data Set
Updating Observations
Deleting Observations
Creating a SAS Data Set from a Matrix
Using the CREATE Statement with the FROM Option
Using the CREATE Statement with the VAR Clause
Understanding the End-of-File Condition
Producing Summary Statistics
Sorting a SAS Data Set
Indexing a SAS Data Set
Data Set Maintenance Functions
Summary of Commands
Comparison with the SAS DATA Step
Summary
File Access
Overview
Referring to an External File
Types of External Files
Reading from an External File
Using the INFILE Statement
Using the INPUT Statement
Writing to an External File
Using the FILE Statement
Using the PUT Statement
Examples
Listing Your External Files
Closing an External File
Summary
General Statistics Examples
Overview
General Statistics Examples
Example 8.1: Correlation
Example 8.2: Newton's Method for Solving Nonlinear Systems of Equations
Example 8.3: Regression
Example 8.4: Alpha Factor Analysis
Example 8.5: Categorical Linear Models
Example 8.6: Regression of Subsets of Variables
Example 8.7: Response Surface Methodology
Example 8.8: Logistic and Probit Regression for Binary Response Models
Example 8.9: Linear Programming
Example 8.10: Quadratic Programming
Example 8.11: Regression Quantiles
Example 8.12: Simulations of a Univariate ARMA Process
Example 8.13: Parameter Estimation for a Regression Model with ARMA Errors
Example 8.14: Iterative Proportional Fitting
Example 8.15: Full-Screen Nonlinear Regression
References
Robust Regression Examples
Overview
Flow Chart for LMS, LTS, MCD, and MVE
Using LMS and LTS
Example 9.1: LMS and LTS with Substantial Leverage Points: Hertzsprung-Russell Star Data
Example 9.2: Comparison of LMS, V7 LTS, and FAST-LTS
Example 9.3: LMS and LTS Univariate (Location) Problem: Barnett and Lewis Data
Using MVE and MCD
Example 9.4: Brainlog Data
Example 9.5: Stackloss Data
Combining Robust Residual and Robust Distance
Example 9.6: Hawkins-Bradu-Kass Data
Example 9.7: Stackloss Data
References
Time Series Analysis and Examples
Overview
Basic Time Series Subroutines
Getting Started
Syntax
Time Series Analysis and Control Subroutines
Getting Started
Syntax
Details
Minimum AIC Procedure
Smoothness Priors Modeling
Bayesian Seasonal Adjustment
Nonstationary Time Series
Multivariate Time Series Analysis
Spectral Analysis
Computational Details
Missing Values
ISM TIMSAC Packages
Example 10.1: VAR Estimation and Variance Decomposition
Kalman Filter Subroutines
Getting Started
Syntax
Example 10.2: Kalman Filtering: Likelihood Function Evaluation
Example 10.3: Kalman Filtering: SSM Estimation With the EM Algorithm
Example 10.4: Diffuse Kalman Filtering
Vector Time Series Analysis Subroutines
Getting Started
Stationary VAR Process
Nonstationary VAR Process
Syntax
Fractionally Integrated Time Series Analysis
Getting Started
Syntax
References
Nonlinear Optimization Examples
Overview
Getting Started
Details
Global versus Local Optima
Kuhn-Tucker Conditions
Definition of Return Codes
Objective Function and Derivatives
Finite-Difference Approximations of Derivatives
Parameter Constraints
Options Vector
Termination Criteria
Control Parameters Vector
Printing the Optimization History
Nonlinear Optimization Examples
Example 11.1: Chemical Equilibrium
Example 11.2: Network Flow and Delay
Example 11.3: Compartmental Analysis
Example 11.4: MLEs for Two-Parameter Weibull Distribution
Example 11.5: Profile-Likelihood-Based Confidence Intervals
Example 11.6: Survival Curve for Interval Censored Data
Example 11.7: A Two-Equation Maximum Likelihood Problem
Example 11.8: Time-Optimal Heat Conduction
References
Graphics Examples
Overview
An Introductory Graph
Details
Graphics Segments
Segment Attributes
Coordinate Systems
Windows and Viewports
Clipping Your Graphs
Common Arguments
Graphics Examples
Example 12.1: Scatter Plot Matrix
Example 12.2: Train Schedule
Example 12.3: Fisher's Iris Data
Window and Display Features
Overview
Creating a Display Window for Data Entry
Using the WINDOW Statement
Window Options
Field Specifications
Using the DISPLAY Statement
Group Specifications
Group Options
Details about Windows
Number and Position of Windows
Windows and the Display Surface
Deciding Where to Define Fields
Groups of Fields
Field Attributes
Display Execution
Field Formatting and Inputting
Display-Only Windows
Opening Windows
Closing Windows
Repeating Fields
Example
Storage Features
Overview
Storage Catalogs
Catalog Management
Restoring Matrices and Modules
Removing Matrices and Modules
Specifying the Storage Catalog
Listing Storage Entries
Storing Matrices and Modules
Using SAS/IML Software to Generate IML Statements
Overview
Generating and Executing Statements
Executing a String Immediately
Feeding an Interactive Program
Calling the Operating System
Calling the SAS Windowing Environment
Executing Any Command in an EXECUTE Call
Making Operands More Flexible
Interrupt Control
Specific Error Control
General Error Control
Macro Interface
IML Line Pushing Contrasted with Using the Macro Facility
Example 15.1: Full-Screen Editing
Summary
Wavelet Analysis
Overview
Some Brief Mathematical Preliminaries
Getting Started
Creating the Wavelet Decomposition
Wavelet Coefficient Plots
Multiresolution Approximation Plots
Multiresolution Decomposition Plots
Wavelet Scalograms
Reconstructing the Signal from the Wavelet Decomposition
Details
Using Symbolic Names
Obtaining Help for the Wavelet Macros and Modules
References
Genetic Algorithms
Overview
Formulating a Genetic Algorithm Optimization
Choosing the Problem Encoding
Setting the Objective Function
Controlling the Selection Process
Using Crossover and Mutation Operators
Executing a Genetic Algorithm
Setting Up the IML Program
Incorporating Local Optimization
Handling Constraints
Example 17.1: Genetic Algorithm with Local Optimization
Example 17.2: Real-Valued Objective Optimization with Constant Bounds
Example 17.3: Integer Programming Knapsack Problem
Example 17.4: Optimization with Linear Constraints Using Repair Strategy
References
Sparse Matrix Algorithms
Overview
Iterative Methods
Input Data Description
Example: Conjugate Gradient Algorithm
Example: Minimum Residual Algorithm
Example: Biconjugate Gradient Algorithm
Symbolic LDL and Cholesky Factorizations
References
Further Notes
Memory and Workspace
Accuracy
Error Diagnostics
Efficiency
Missing Values
Principles of Operation
Operation-Level Execution
Language Reference
Overview
Operators
Addition Operator: +
Comparison Operators: < > = <= >= ^=
Concatenation Operator, Horizontal: ||
Concatenation Operator, Vertical: //
Direct Product Operator: @
Division Operator: /
Element Maximum Operator: <>
Element Minimum Operator: ><
Index Creation Operator: :
Logical Operators: & | ^
Multiplication Operator, Elementwise: #
Multiplication Operator, Matrix: *
Power Operator, Elementwise: ##
Power Operator, Matrix: **
Sign Reverse Operator: -
Subscripts: [ ]
Subtraction Operator: -
Transpose Operator: `
Statements, Functions, and Subroutines
ABORT Statement
ABS Function
ALL Function
ANY Function
APPCORT Call
APPEND Statement
APPLY Function
ARMACOV Call
ARMALIK Call
ARMASIM Function
BLOCK Function
BRANKS Function
BSPLINE Function
BTRAN Function
BYTE Function
CALL Statement
CHANGE Call
CHAR Function
CHOOSE Function
CLOSE Statement
CLOSEFILE Statement
COMPORT Call
CONCAT Function
CONTENTS Function
CONVEXIT Function
COVLAG Function
CREATE Statement
CSHAPE Function
CUSUM Function
CVEXHULL Function
DATASETS Function
DELETE Call
DELETE Statement
DESIGN Function
DESIGNF Function
DET Function
DIAG Function
DISPLAY Statement
DO Function
DO and END Statements
DO Statement, Iterative
DO DATA Statement
DO Statement with an UNTIL Clause
DO Statement with a WHILE Clause
DURATION Function
ECHELON Function
EDIT Statement
EIGEN Call
EIGVAL Function
EIGVEC Function
END Statement
EXECUTE Call
EXP Function
FARMACOV Call
FARMAFIT Call
FARMALIK Call
FARMASIM Call
FDIF Call
FFT Function
FILE Statement
FIND Statement
FINISH Statement
FORCE Statement
FORWARD Function
FREE Statement
GAEND Call - Experimental
GAGETMEM Call - Experimental
GAGETVAL Call - Experimental
GAINIT Call - Experimental
GAREEVAL Call - Experimental
GAREGEN Call - Experimental
GASETCRO Call - Experimental
GASETMUT Call - Experimental
GASETOBJ Call - Experimental
GASETSEL Call - Experimental
GASETUP Function - Experimental
GBLKVP Call
GBLKVPD Call
GCLOSE Call
GDELETE Call
GDRAW Call
GDRAWL Call
GENEIG Call
GEOMEAN Function
GGRID Call
GINCLUDE Call
GINV Function
GOPEN Call
GOTO Statement
GPIE Call
GPIEXY Call
GPOINT Call
GPOLY Call
GPORT Call
GPORTPOP Call
GPORTSTK Call
GSCALE Call
GSCRIPT Call
GSET Call
GSHOW Call
GSORTH Call
GSTART Call
GSTOP Call
GSTRLEN Call
GTEXT and GVTEXT Calls
GWINDOW Call
GXAXIS and GYAXIS Calls
HADAMARD Function
HALF Function
HANKEL Function
HARMEAN Function
HDIR Function
HERMITE Function
HOMOGEN Function
I Function
IF-THEN/ELSE Statement
IFFT Function
INDEX Statement
INFILE Statement
INPUT Statement
INSERT Function
INT Function
INV Function
INVUPDT Function
IPF Call
ITSOLVER Call
J Function
JROOT Function
KALCVF Call
KALCVS Call
KALDFF Call
KALDFS Call
LAV Call
LCP Call
LENGTH Function
LINK and RETURN Statements
LIST Statement
LMS Call
LOAD Statement
LOC Function
LOG Function
LP Call
LTS Call
LUPDT Call
MAD Function
MARG Call
MATTRIB Statement
MAX Function
MAXQFORM Call
MCD Call
MIN Function
MOD Function
MODULEI Call
MODULEIC Function
MODULEIN Function
MVE Call
NAME Function
NCOL Function
NLENG Function
Nonlinear Optimization and Related Subroutines
NLPCG Call
NLPDD Call
NLPFDD Call
NLPFEA Call
NLPHQN Call
NLPLM Call
NLPNMS Call
NLPNRA Call
NLPNRR Call
NLPQN Call
NLPQUA Call
NLPTR Call
NORMAL Function
NROW Function
NUM Function
ODE Call
ODSGRAPH Call
OPSCAL Function
ORPOL Function
ORTVEC Call
PAUSE Statement
PGRAF Call
POLYROOT Function
PRINT Statement
PRODUCT Function
PURGE Statement
PUSH Call
PUT Statement
PV Function
QR Call
QUAD Call
QUEUE Call
QUIT Statement
RANDGEN Call
RANDSEED Call
RANK Function
RANKTIE Function
RATES Function
RATIO Function
RDODT and RUPDT Calls
READ Statement
REMOVE Function
REMOVE Statement
RENAME Call
REPEAT Function
REPLACE Statement
RESET Statement
RESUME Statement
RETURN Statement
ROOT Function
ROWCAT Function
ROWCATC Function
RUN Statement
RUPDT Call
RZLIND Call
SAVE Statement
SEQ, SEQSCALE, and SEQSHIFT Calls
SEQSCALE Call
SEQSHIFT Call
SETDIF Function
SETIN Statement
SETOUT Statement
SHAPE Function
SHOW Statement
SOLVE Function
SOLVELIN Call
SORT Call
SORT Statement
SORTNDX Call
SOUND Call
SPLINE and SPLINEC Calls
SPLINEV Function
SPOT Function
SQRSYM Function
SQRT Function
SSQ Function
START and FINISH Statements
STOP Statement
STORAGE Function
STORE Statement
SUBSTR Function
SUM Function
SUMMARY Statement
SVD Call
SWEEP Function
SYMSQR Function
T Function
TEIGEN Call
TEIGVAL Function
TEIGVEC Function
TOEPLITZ Function
TPSPLINE Call
TPSPLNEV Call
TRACE Function
TRISOLV Function
TSBAYSEA Call
TSDECOMP Call
TSMLOCAR Call
TSMLOMAR Call
TSMULMAR Call
TSPEARS Call
TSPRED Call
TSROOT Call
TSTVCAR Call
TSUNIMAR Call
TYPE Function
UNIFORM Function
UNION Function
UNIQUE Function
UNIQUEBY Function
USE Statement
VALSET Call
VALUE Function
VARMACOV Call
VARMALIK Call
VARMASIM Call
VECDIAG Function
VNORMAL Call
VTSROOT Call
WAVFT Call
WAVGET Call
WAVIFT Call
WAVPRINT Call
WAVTHRSH Call
WINDOW Statement
XMULT Function
XSECT Function
YIELD Function
Base SAS Functions Accessible from SAS/IML
Bitwise Logical Operation Functions
Character and Formatting Functions
Character String Matching Functions and Subroutines
Date and Time Functions
Descriptive Statistics Functions and Subroutines
Double-Byte Character String Functions
External Files Functions
File I/O Functions
Financial Functions
Macro Functions and Subroutines
Mathematical Functions and Subroutines
Probability Functions
Quantile Functions
Random Number Functions and Subroutines
State and Zip Code Functions
Trigonometric and Hyperbolic Functions
Truncation Functions
Web Tools
References
Module Library
Overview
Contents of IMLMLIB
IMLMLIB and the STORAGE library
Accessing the IML Source Code
Order of Resolution
Error Diagnostics
Modules for Multivariate Random Sampling
Modules Reference
COLVEC Function
CORR Function
EXPMATRIX Function
GBXWHSKR Call
GPROBCNT Call
GXYPLOT Call
MEDIAN Function
QUADREG Call
QUARTILE Function
RANDDIRICHLET Function
RANDMULTINOMIAL Function
RANDMVT Function
RANDNORMAL Function
RANDWISHART Function
REGRESS Call
ROWVEC Function
RSUBSTR Function
STANDARD Function
TABPRT Call
References
Product
Release
SAS/IML
9.2
Type
Usage and Reference
Copyright Date
March 2008
Last Updated
01Oct2009