Chapter Contents
Chapter Contents
Language Reference


This chapter describes all operators, statements, functions, and subroutines that can be used in SAS/IML software. All necessary details, such as arguments and operands, are included. The first section contains operator descriptions. They are in alphabetic order according to the name of the operator. The second section contains descriptions of statements, functions, and subroutines also arranged alphabetically by name.

The following tables list all statements, functions, and subroutines available in SAS/IML software grouped by functionality.

Scalar Functions

ABS Functiontakes the absolute value
EXP Functioncalculates the exponential
INT Functiontruncates a value
LOG Functiontakes the natural logarithm
MOD Functioncomputes the modulo (remainder)
NORMAL Functiongenerates a pseudo-random normal deviate
SQRT Functioncalculates the square root
UNIFORM Functiongenerates pseudo-random uniform deviates

Reduction Functions

MAX Functionfinds the maximum value of a matrix
MIN Functionfinds the smallest element of a matrix
SSQ Functioncalculates the sum of squares of all elements
SUM Functionsums all elements

Matrix Inquiry Functions

ALL Functionchecks for all nonzero elements
ANY Functionchecks for any nonzero elements
LOC Functionfinds nonzero elements of a matrix
NCOL Functionfinds the number of columns of a matrix
NLENG Functionfinds the size of an element
NROW Functionfinds the number of rows of a matrix
TYPE Functiondetermines the type of a matrix

Matrix Reshaping Functions

BLOCK Functionforms block-diagonal matrices
BTRAN Functioncomputes block transpose
DIAG Functioncreates a diagonal matrix
DO Functionproduces an arithmetic series
I Functioncreates an identity matrix
INSERT Functioninserts one matrix inside another
J Functioncreates a matrix of identical values
REMOVE Functiondiscards elements from a matrix
REPEAT Functioncreates a new matrix of repeated values
SHAPE Functionreshapes and repeats values
SQRSYM Functionconverts a symmetric matrix to a square matrix
SYMSQR Functionconverts a square matrix to a symmetric matrix
T Functiontransposes a matrix
VECDIAG Functioncreates a vector from a diagonal

Character Functionality

BYTE Functiontranslates numbers to ordinal characters
CHANGE Callreplaces text
CHAR Functionproduces a character representation of a matrix
CHOOSE Functionconditionally chooses and changes elements
CONCAT FunctionConcatenates elementwise strings
CONVMOD Functionconverts modules to character matrices
CSHAPE Functionreshapes and repeats character values
LENGTH Callfinds the lengths of character matrix elements
NAME Functionlists the names of arguments
NUM Functionproduces a numeric representation of a character matrix
ROWCAT Functionconcatenates rows without using blank compression
ROWCATC Functionconcatenates rows using blank compression
SUBSTR Functiontakes substrings of matrix elements

Statistical Functionality

BRANKS Functioncomputes bivariate ranks
CUSUM Functioncalculates cumulative sums
DESIGN Functioncreates a design matrix
DESIGNF Functioncreates a full rank design matrix
IPF Callperforms an iterative proportional fit
LAV Callperforms linear least absolute value regression by solving the L1 norm minimization problem
LMS Callperforms robust regression
LTS Callperforms robust regression
MARG Callevaluates marginal totals in a multiway contingency table
MAXQFORM Callcomputes the subsets of a matrix system that maximize the quadratic form
MVE Callfinds the minimum volume ellipsoid estimator
OPSCAL Functionrescales qualitative data to be a least-squares fit to qualitative data
RANK Functionranks elements of a matrix
RANKTIE Functionranks matrix elements using tie-averaging
SEQSCALE Callperform discrete sequential tests
SEQSHIFT Callperform discrete sequential tests
SEQTESTS Callsperform discrete sequential tests
SWEEP Functionsweeps a matrix

Time Series Functionality

ARMACOV Callcomputes an autocovariance sequence for an ARMA model
ARMALIK Callcomputes the log likelihood and residuals for an ARMA model
ARMASIM Functionsimulates an ARMA series
CONVEXIT Functioncalculates convexity of a non-contingent cash-flow
COVLAG Functioncomputes autocovariance estimates for a vector time series
DURATION Functioncalculates modified duration of a non-contingent cash-flow
FORWARD Functioncalculates forward rates
KALCVF Callcomputes the one-step prediction z_{t+1| t} and the filtered estimate z_{t| t}, as well as their covariance matrices. The call uses forward recursions, and you can also use it to obtain k-step estimates.
KALCVS Calluses backward recursions to compute the smoothed estimate z_{t| T} and its covariance matrix, P_{t| T}, where T is the number of observations in the complete data set.
KALDFF Callcomputes the one-step forecast of state vectors in an SSM using the diffuse Kalman filter. The call estimates the conditional expectation of zt, and it also estimates the initial random vector, \delta, and its covariance matrix.
KALDFS Callcomputes the smoothed state vector and its mean square error matrix from the one-step forecast and mean square error matrix computed by KALDFF.
PV Functioncalculates present value
RATES Functionconverts interest rates from one base to another
SPOT Functioncalculates spot rates
TSBAYSEA Callperforms Bayesian seasonal adjustment modeling
TSDECOMP Callanalyzes nonstationary time series by using smoothness priors modeling
TSMLOMAR Callanalyzes nonstationary or locally stationary multivariate time series by using the minimum AIC procedure
TSMULMAR Callestimates VAR processes by using the minimum AIC procedure
TSPEARS Callanalyzes periodic AR models with the minimum AIC procedure
TSPRED Callprovides predicted values of univariate and multivariate ARMA processes when the ARMA coefficients are input
TSROOT Callcalculates AR and MA coefficients from the characteristic roots of the model or calculates the characteristic roots of the model from the AR and MA coefficients
TSTVCAR Callanalyzes time series that are nonstationary in the covariance function
TSUNIMAR Calldetermines the order of an AR process with the minimum AIC procedure and estimates the AR coefficients
VARMACOV Callcomputes the theoretical auto-cross covariance matrices for the stationary VARMA(p,q) model
VARMASIM Callgenerates VARMA(p,q) time series
VNORMAL Callgenerates multivariate normal random series
VTSROOT Callcomputes the characteristic roots for the VAR(p) or VMA(q) model
YIELD Functioncalculates yield-to-maturity of a cash-flow stream

Numerical Analysis Functionality

FFT Functionperforms the finite Fourier transform
IFFT Functioncomputes the inverse finite Fourier transform
JROOT Functioncomputes the first nonzero roots of a Bessel function of the first kind and the derivative of the Bessel function at each root
ODE Callperforms numerical integration of vector differential equations of the form
ORPOL Functiongenerates orthogonal polynomials
ORTVEC Callprovides columnwise orthogonalization by the Gram-Schmidt process and stepwise QR decomposition by the Gram-Schmidt process
POLYROOT Functionfinds zeros of a real polynomial
PRODUCT Functionmultiplies matrices of polynomials
QUAD Callperforms numerical integration of scalar functions in one dimension over infinite, connected semi-infinite, and connected finite intervals
RATIO Functiondivides matrix polynomials
SPLINE Callevaluates points on the spline
SPLINEC Callevaluates points on the spline
SPLINEV Functionevaluates points on a spline
TPSPLINE Callcomputes thin-plate smoothing splines
TPSPLNEV Callevaluates the thin-plate smoothing spline at new data points

Linear Algebra Functionality

APPCORT CALLcomplete orthogonal decomposition
COMPORT Callcomplete orthogonal decomposition by Householder transformations
CVEXHULL Functionfinds a convex hull of a set of planar points
DET Functioncomputes the determinant of a square matrix
ECHELON Functionreduces a matrix to row-echelon normal form
EIGEN Callcomputes eigenvalues and eigenvectors of symmetric matrices
EIGVAL Functioncomputes eigenvalues
EIGVEC Functioncomputes eigenvectors
GENEIG Callcomputes eigenvalues and eigenvectors of a generalized eigenproblem
GINV Functioncomputes the generalized inverse
GSORTH Callcomputes the Gram-Schmidt orthonormalization
HALF Functioncomputes Cholesky decomposition
HANKEL Functiongenerates a Hankel matrix
HDIR Functionperforms a horizontal direct product
HERMITE Functionreduces a matrix to Hermite normal form
HOMOGEN Functionsolves homogeneous linear systems
INV Functionproduces the inverse
INVUPDT Functionupdates a matrix inverse
LUPDT Callprovides updating and downdating for rank deficient linear least squares solutions, complete orthogonal factorization, and Moore-Penrose inverses
QR Callproduces the QR decomposition of a matrix by Householder transformations
RDODT Calldowndate and update QR and Cholesky decompositions
ROOT Functionperforms the Cholesky decomposition of a matrix
RUPDT Callupdate QR and Cholesky decompositions
RZLIND Callupdate QR and Cholesky decompositions
SOLVE Functionsolves a system of linear equations
SVD Callcomputes the singular value decomposition
TOEPLITZ Functiongenerates a Toeplitz or block-Toeplitz matrix
TRACE Functionsums diagonal elements
TRISOLV Functionsolves linear systems with triangular matrices
XMULT Functionperforms accurate matrix multiplication

Optimization Subroutines

LCP Callsolves the linear complementarity problem
LP Callsolves the linear programming problem
NLPCG Callnonlinear optimization by conjugate gradient method
NLPDD Callnonlinear optimization by double dogleg method
NLPFDD Callapproximates derivatives by finite differences method
NLPFEA Callcomputes feasible points subject to constraints
NLPHQN Callcalculates hybrid quasi-Newton least squares
NLPLM Callcalculates Levenberg-Marquardt least squares
NLPNMS Callnonlinear optimization by Nelder-Mead simplex method
NLPNRA Callnonlinear optimization by Newton-Raphson method
NLPNRR Callnonlinear optimization by Newton-Raphson ridge method
NLPQN Callnonlinear optimization by quasi-Newton method
NLPQUA Callnonlinear optimization by quadratic method
NLPTR Callnonlinear optimization by trust region method

Set Functions

SETDIF Functioncompares elements of two matrices
UNION Functionperforms unions of sets
UNIQUE Functionsorts and removes duplicates
XSECT Functionintersects sets

Control Statements

ABORT Statementends IML
APPLY Functionapplies an IML module
DO and END Statementsgroups statements as a unit
DO, Iterative Statementiteratively executes a Do group
DO and UNTIL Statement and Clauseconditionally executes statements iteratively
DO and WHILE Statement and Clauseconditionally executes statements iteratively
END Statementends a DO loop or DO statement
EXECUTE Callexecutes SAS statements immediately
FINISH Statementdenotes the end of a module
FORCE Statementsee the description of the SAVE statement
FREE Statementfrees matrix storage space
GOTO Statementjumps to a new statement
IFTHEN Statementconditionally executes statement
LINK Statementjump to another statement
MATTRIB Statementassociates printing attributes with matrices
PARSE Statementparses matrix elements as statements
PAUSE Statementinterrupts module execution
PRINT Statementprints matrix values
PURGE Statementremoves observations marked for deletion and renumbers records
PUSH Callpushes SAS statements into the command input stream
QUEUE Callqueues SAS statements into the command input stream
QUIT Statementexits from IML
REMOVE Statementremoves matrices from storage
RESET Statementsets processing options
RESUME Statementresumes execution
RETURN Statementreturns to caller
RUN Statementexecutes statements in a module
SHOW Statementprints system information
SOUND Callproduces a tone
START/FINISH Statementsdefine a module
STOP Statementstops execution of statements
STORAGE Functionlists names of matrices and modules in storage
STORE Statementstores matrices and modules in library storage
VALSET Callperforms indirect assignment
VALUE Functionassigns values by indirect reference

Dataset and File Functionality

APPEND Statementadds observations to SAS dataset
CLOSE Statementcloses a SAS dataset
CLOSEFILE Statementcloses a file
CONTENTS Functionreturns the variables in a SAS dataset
CREATE Statementcreates a new SAS dataset
DATASETS Functionobtains the names of SAS datasets
DELETE Calldeletes a SAS data set
DELETE Statementmarks observations for deletion
DO DATA Statementrepeats a loop until an end of file occurs
EDIT Statementopens a SAS data set for editing
FILE Statementopens or points to an external file
FIND Statementfinds observations
INDEX Statementindexes a variable in a SAS data set
INFILE Statementopens a file for input
INPUT Statementinputs data
LIST Statementdisplays observations of a data set
LOAD Statementloads modules and matrices from library storage
PUT Statementwrites data to an external file
READ Statementreads observations from a data set
RENAME Callrenames a SAS data set
REPLACE Statementreplaces values in observations and updates observations
SAVE Statementsaves data
SETIN Statementmakes a data set current for input
SETOUT Statementmakes a data set current for output
SORT Statementsorts a SAS data set
SUMMARY Statementcomputes summary statistics for SAS data sets
USE Statementopens a SAS data set for reading

Graphics and Window Functions

DISPLAY Statementdisplays fields in a display window
GBLKVP Calldefines a blanking viewport
GBLKVPD Calldeletes the blanking viewport
GCLOSE Callcloses the graphics segment
GDELETE Calldeletes a graphics segment
GDRAW Calldraws a polyline
GDRAWL Calldraws individual lines
GGRID Calldraws a grid
GINCLUDE Callincludes a graphics segment
GOPEN Callopens a graphics segment
GPIE Calldraws pie slices
GPIEXY Callconverts from polar to world coordinates
GPOINT Callplots points
GPOLY Calldraws and fills a polygon
GPORT Calldefines a viewport
GPORTPOP Callpops the viewport
GPORTSTK Callstacks the viewport
GSCALE Callcalculates round numbers for labeling axes
GSCRIPT Callwrites multiple text strings with special fonts
GSET Callsets attributes for a graphics segment
GSHOW Callshows a graph
GSTART Callinitializes the graphics system
GSTOP Calldeactivates the graphics system
GSTRLEN Callfinds the string length
GTEXT and GVTEXT Callsplace text horizontally or vertically on a graph
GWINDOW Calldefines the data window
GXAXIS and GYAXIS Callsdraw a horizontal or vertical axis
PGRAF Callproduces scatter plots
WINDOW Statementopens a display window

Chapter Contents
Chapter Contents

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.