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.

This chapter is divided into two sections. 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
CHOOSE Functionconditionally chooses and changes 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 Sorting and BY-Group Processing Calls

SORT Callsorts a matrix by specified columns
SORTNDX Callcreates a sorted index for a matrix
UNIQUEBY Functionfinds locations of unique BY groups in a sorted or indexed 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
CONCAT FunctionConcatenates elementwise strings
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 by using blank compression
SUBSTR Functiontakes substrings of matrix elements

Random Number Generation Functionality

RANDGEN Callgenerates random numbers from specified distributions
RANDSEED Callinitializes seed for subsequent RANGEN calls

Statistical Functionality

BRANKS Functioncomputes bivariate ranks
CUSUM Functioncalculates cumulative sums
DESIGN Functioncreates a design matrix
DESIGNF Functioncreates a full-rank design matrix
GEOMEAN Functioncalculates geometric means
HADAMARD Functioncreates a Hadamard matrix
HARMEAN Functioncalculates harmonic means
IPF Callperforms an iterative proportional fit of a contingency table
LAV Callperforms linear least absolute value regression by solving the l_1 norm minimization problem
LMS Callperforms robust regression
LTS Callperforms robust regression
MAD Functionfinds the univariate (scaled) median absolute deviation
MARG Callevaluates marginal totals in a multiway contingency table
MAXQFORM Callcomputes the subsets of a matrix system that maximize the quadratic form
MCD Callfinds the minimum covariance determinant estimator
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 by 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 noncontingent cash flow
COVLAG Functioncomputes autocovariance estimates for a vector time series
DURATION Functioncalculates modified duration of a noncontingent cash flow
FARMACOV Callcomputes the autocovariance function for an ARFIMA(p,d,q) process
FARMAFIT Callestimate the parameters of an ARFIMA(p,d,q) model
FARMALIK Callcomputes the log-likelihood function of an ARFIMA(p,d,q) model
FARMASIM Callgenerates an ARFIMA(p,d,q) process
FDIF Callobtain a fractionally differenced process
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 by using the diffuse Kalman filter. The call estimates the conditional expectation of {z}_t, 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
TSMLOCAR Callanalyzes nonstationary or locally stationary time series by using the minimum AIC procedure
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 cross-covariance matrices for a stationary VARMA(p,q) model
VARMALIK Callcomputes the log-likelihood function for a VARMA(p,q) model
VARMASIM Callgenerates VARMA(p,q) time series
VNORMAL Callgenerates multivariate normal random series
VTSROOT Callcomputes the characteristic roots for a VARMA(p,q) model
YIELD Functioncalculates yield-to-maturity of a cash-flow stream

Numerical Analysis Functionality

BSPLINE Functioncomputes B-spline basis
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 on a discrete set of points
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 Callfits a cubic spline to points
SPLINEC Callfits a cubic spline to points
SPLINEV Functionevaluates a cubic spline at new data points
TPSPLINE Callcomputes thin-plate smoothing splines
TPSPLNEV Callevaluates the thin-plate smoothing spline at new data points

Linear Algebra Functionality

APPCORT CALLcompletes orthogonal decomposition
COMPORT Callcompletes 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
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
ITSOLVER Callsolves a sparse general linear system by iteration
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 Calldowndates and updates QR and Cholesky decompositions
ROOT Functionperforms the Cholesky decomposition of a matrix
RUPDT Callupdates QR and Cholesky decompositions
RZLIND Callupdates QR and Cholesky decompositions
SOLVE Functionsolves a system of linear equations
SOLVELIN Callsolves a sparse symmetric system of linear equations by direct decomposition
SVD Callcomputes the singular value decomposition
TEIGEN Callcomputes the eigenvalues and eigenvectors of square matrices
TEIGVAL Functioncomputes eigenvalues of square matrices
TEIGVEC Functioncomputes eigenvectors of square matrices
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 Callperforms nonlinear optimization by conjugate gradient method
NLPDD Callperforms nonlinear 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 Callperforms nonlinear optimization by Nelder-Mead simplex method
NLPNRA Callperforms nonlinear optimization by Newton-Raphson method
NLPNRR Callperforms nonlinear optimization by Newton-Raphson ridge method
NLPQN Callperforms nonlinear optimization by quasi-Newton method
NLPQUA Callperforms nonlinear optimization by quadratic method
NLPTR Callperforms nonlinear optimization by trust-region method
Nonlinear Optimization and Related Subroutineslists of all nonlinear optimization and related subroutines in IML

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
CALL Statementcalls a subroutine or function
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 Statement(see the description of the SAVE statement)
FREE Statementfrees matrix storage space
GOTO Statementjumps to a new statement
IF-THEN/ELSE Statementconditionally executes statement
LINK Statementjumps to another statement
MATTRIB Statementassociates printing attributes with matrices
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

Datas Set and File Functionality

APPEND Statementadds observations to SAS data set
CLOSE Statementcloses a SAS data set
CLOSEFILE Statementcloses a file
CONTENTS Functionreturns the variables in a SAS data set
CREATE Statementcreates a new SAS data set
DATASETS Functionobtains the names of SAS data sets
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 Callsplaces text horizontally or vertically on a graph
GWINDOW Calldefines the data window
GXAXIS and GYAXIS Callsdraws a horizontal or vertical axis
PGRAF Callproduces scatter plots
ODSGRAPH Callrenders a graph by using ODS Statistical Graphics
WINDOW Statementopens a display window

Wavelet Analysis Calls

WAVFT Callcomputes a specified wavelet transform of one dimensional data
WAVGET Callreturns requested information encapsulated in a wavelet transform
WAVIFT Callinverts a wavelet transform after applying specified thresholding to the detail coefficients
WAVPRINT Calldisplays requested information encapsulated in a wavelet transform
WAVTHRSH Callapplies specified thresholding to the detail coefficients of a wavelet transform

Genetic Algorithm Functionality

GAEND Callterminates genetic algorithm and frees memory resources
GAGETMEM Callgets requested members and objective values from current solution population
GAGETVAL Callgets objective function values for requested member of current solution population
GAINIT Callinitializes the initial solution population
GAREEVAL Callreevaluates the objective function for all solutions in current population
GASETCRO Callspecifies a current crossover operator
GASETMUT Callspecifies a current mutation operator
GASETOBJ Callspecifies a current objective function
GASETSEL Callspecifies a current selection parameters
GASETUP Functionsets up a specific genetic algorithm optimization problem

Calling External Modules

MODULEI Callcalls an external routine without any return code
MODULEIC Callcalls an external routine that returns a character
MODULEIC Callcalls an external routine that returns a numeric value

Previous Page | Next Page | Top of Page