Chapter Contents Previous Next
 Language Reference

# Overview

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 Function takes the absolute value EXP Function calculates the exponential INT Function truncates a value LOG Function takes the natural logarithm MOD Function computes the modulo (remainder) NORMAL Function generates a pseudo-random normal deviate SQRT Function calculates the square root UNIFORM Function generates pseudo-random uniform deviates

### Reduction Functions

 MAX Function finds the maximum value of a matrix MIN Function finds the smallest element of a matrix SSQ Function calculates the sum of squares of all elements SUM Function sums all elements

### Matrix Inquiry Functions

 ALL Function checks for all nonzero elements ANY Function checks for any nonzero elements LOC Function finds nonzero elements of a matrix NCOL Function finds the number of columns of a matrix NLENG Function finds the size of an element NROW Function finds the number of rows of a matrix TYPE Function determines the type of a matrix

### Matrix Reshaping Functions

 BLOCK Function forms block-diagonal matrices BTRAN Function computes block transpose DIAG Function creates a diagonal matrix DO Function produces an arithmetic series I Function creates an identity matrix INSERT Function inserts one matrix inside another J Function creates a matrix of identical values REMOVE Function discards elements from a matrix REPEAT Function creates a new matrix of repeated values SHAPE Function reshapes and repeats values SQRSYM Function converts a symmetric matrix to a square matrix SYMSQR Function converts a square matrix to a symmetric matrix T Function transposes a matrix VECDIAG Function creates a vector from a diagonal

### Character Functionality

 BYTE Function translates numbers to ordinal characters CHANGE Call replaces text CHAR Function produces a character representation of a matrix CHOOSE Function conditionally chooses and changes elements CONCAT Function Concatenates elementwise strings CONVMOD Function converts modules to character matrices CSHAPE Function reshapes and repeats character values LENGTH Call finds the lengths of character matrix elements NAME Function lists the names of arguments NUM Function produces a numeric representation of a character matrix ROWCAT Function concatenates rows without using blank compression ROWCATC Function concatenates rows using blank compression SUBSTR Function takes substrings of matrix elements

### Statistical Functionality

 BRANKS Function computes bivariate ranks CUSUM Function calculates cumulative sums DESIGN Function creates a design matrix DESIGNF Function creates a full rank design matrix IPF Call performs an iterative proportional fit LAV Call performs linear least absolute value regression by solving the L1 norm minimization problem LMS Call performs robust regression LTS Call performs robust regression MARG Call evaluates marginal totals in a multiway contingency table MAXQFORM Call computes the subsets of a matrix system that maximize the quadratic form MVE Call finds the minimum volume ellipsoid estimator OPSCAL Function rescales qualitative data to be a least-squares fit to qualitative data RANK Function ranks elements of a matrix RANKTIE Function ranks matrix elements using tie-averaging SEQSCALE Call perform discrete sequential tests SEQSHIFT Call perform discrete sequential tests SEQTESTS Calls perform discrete sequential tests SWEEP Function sweeps a matrix

### Time Series Functionality

 ARMACOV Call computes an autocovariance sequence for an ARMA model ARMALIK Call computes the log likelihood and residuals for an ARMA model ARMASIM Function simulates an ARMA series CONVEXIT Function calculates convexity of a non-contingent cash-flow COVLAG Function computes autocovariance estimates for a vector time series DURATION Function calculates modified duration of a non-contingent cash-flow FORWARD Function calculates forward rates KALCVF Call computes the one-step prediction and the filtered estimate , as well as their covariance matrices. The call uses forward recursions, and you can also use it to obtain k-step estimates. KALCVS Call uses backward recursions to compute the smoothed estimate and its covariance matrix, , where T is the number of observations in the complete data set. KALDFF Call computes 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, , and its covariance matrix. KALDFS Call computes the smoothed state vector and its mean square error matrix from the one-step forecast and mean square error matrix computed by KALDFF. PV Function calculates present value RATES Function converts interest rates from one base to another SPOT Function calculates spot rates TSBAYSEA Call performs Bayesian seasonal adjustment modeling TSDECOMP Call analyzes nonstationary time series by using smoothness priors modeling TSMLOMAR Call analyzes nonstationary or locally stationary multivariate time series by using the minimum AIC procedure TSMULMAR Call estimates VAR processes by using the minimum AIC procedure TSPEARS Call analyzes periodic AR models with the minimum AIC procedure TSPRED Call provides predicted values of univariate and multivariate ARMA processes when the ARMA coefficients are input TSROOT Call calculates 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 Call analyzes time series that are nonstationary in the covariance function TSUNIMAR Call determines the order of an AR process with the minimum AIC procedure and estimates the AR coefficients VARMACOV Call computes the theoretical auto-cross covariance matrices for the stationary VARMA(p,q) model VARMASIM Call generates VARMA(p,q) time series VNORMAL Call generates multivariate normal random series VTSROOT Call computes the characteristic roots for the VAR(p) or VMA(q) model YIELD Function calculates yield-to-maturity of a cash-flow stream

### Numerical Analysis Functionality

 FFT Function performs the finite Fourier transform IFFT Function computes the inverse finite Fourier transform JROOT Function computes the first nonzero roots of a Bessel function of the first kind and the derivative of the Bessel function at each root ODE Call performs numerical integration of vector differential equations of the form ORPOL Function generates orthogonal polynomials ORTVEC Call provides columnwise orthogonalization by the Gram-Schmidt process and stepwise QR decomposition by the Gram-Schmidt process POLYROOT Function finds zeros of a real polynomial PRODUCT Function multiplies matrices of polynomials QUAD Call performs numerical integration of scalar functions in one dimension over infinite, connected semi-infinite, and connected finite intervals RATIO Function divides matrix polynomials SPLINE Call evaluates points on the spline SPLINEC Call evaluates points on the spline SPLINEV Function evaluates points on a spline TPSPLINE Call computes thin-plate smoothing splines TPSPLNEV Call evaluates the thin-plate smoothing spline at new data points

### Linear Algebra Functionality

 APPCORT CALL complete orthogonal decomposition COMPORT Call complete orthogonal decomposition by Householder transformations CVEXHULL Function finds a convex hull of a set of planar points DET Function computes the determinant of a square matrix ECHELON Function reduces a matrix to row-echelon normal form EIGEN Call computes eigenvalues and eigenvectors of symmetric matrices EIGVAL Function computes eigenvalues EIGVEC Function computes eigenvectors GENEIG Call computes eigenvalues and eigenvectors of a generalized eigenproblem GINV Function computes the generalized inverse GSORTH Call computes the Gram-Schmidt orthonormalization HALF Function computes Cholesky decomposition HANKEL Function generates a Hankel matrix HDIR Function performs a horizontal direct product HERMITE Function reduces a matrix to Hermite normal form HOMOGEN Function solves homogeneous linear systems INV Function produces the inverse INVUPDT Function updates a matrix inverse LUPDT Call provides updating and downdating for rank deficient linear least squares solutions, complete orthogonal factorization, and Moore-Penrose inverses QR Call produces the QR decomposition of a matrix by Householder transformations RDODT Call downdate and update QR and Cholesky decompositions ROOT Function performs the Cholesky decomposition of a matrix RUPDT Call update QR and Cholesky decompositions RZLIND Call update QR and Cholesky decompositions SOLVE Function solves a system of linear equations SVD Call computes the singular value decomposition TOEPLITZ Function generates a Toeplitz or block-Toeplitz matrix TRACE Function sums diagonal elements TRISOLV Function solves linear systems with triangular matrices XMULT Function performs accurate matrix multiplication

### Optimization Subroutines

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

### Set Functions

 SETDIF Function compares elements of two matrices UNION Function performs unions of sets UNIQUE Function sorts and removes duplicates XSECT Function intersects sets

### Control Statements

 ABORT Statement ends IML APPLY Function applies an IML module DO and END Statements groups statements as a unit DO, Iterative Statement iteratively executes a Do group DO and UNTIL Statement and Clause conditionally executes statements iteratively DO and WHILE Statement and Clause conditionally executes statements iteratively END Statement ends a DO loop or DO statement EXECUTE Call executes SAS statements immediately FINISH Statement denotes the end of a module FORCE Statement see the description of the SAVE statement FREE Statement frees matrix storage space GOTO Statement jumps to a new statement IFTHEN Statement conditionally executes statement LINK Statement jump to another statement MATTRIB Statement associates printing attributes with matrices PARSE Statement parses matrix elements as statements PAUSE Statement interrupts module execution PRINT Statement prints matrix values PURGE Statement removes observations marked for deletion and renumbers records PUSH Call pushes SAS statements into the command input stream QUEUE Call queues SAS statements into the command input stream QUIT Statement exits from IML REMOVE Statement removes matrices from storage RESET Statement sets processing options RESUME Statement resumes execution RETURN Statement returns to caller RUN Statement executes statements in a module SHOW Statement prints system information SOUND Call produces a tone START/FINISH Statements define a module STOP Statement stops execution of statements STORAGE Function lists names of matrices and modules in storage STORE Statement stores matrices and modules in library storage VALSET Call performs indirect assignment VALUE Function assigns values by indirect reference

### Dataset and File Functionality

 APPEND Statement adds observations to SAS dataset CLOSE Statement closes a SAS dataset CLOSEFILE Statement closes a file CONTENTS Function returns the variables in a SAS dataset CREATE Statement creates a new SAS dataset DATASETS Function obtains the names of SAS datasets DELETE Call deletes a SAS data set DELETE Statement marks observations for deletion DO DATA Statement repeats a loop until an end of file occurs EDIT Statement opens a SAS data set for editing FILE Statement opens or points to an external file FIND Statement finds observations INDEX Statement indexes a variable in a SAS data set INFILE Statement opens a file for input INPUT Statement inputs data LIST Statement displays observations of a data set LOAD Statement loads modules and matrices from library storage PUT Statement writes data to an external file READ Statement reads observations from a data set RENAME Call renames a SAS data set REPLACE Statement replaces values in observations and updates observations SAVE Statement saves data SETIN Statement makes a data set current for input SETOUT Statement makes a data set current for output SORT Statement sorts a SAS data set SUMMARY Statement computes summary statistics for SAS data sets USE Statement opens a SAS data set for reading

### Graphics and Window Functions

 DISPLAY Statement displays fields in a display window GBLKVP Call defines a blanking viewport GBLKVPD Call deletes the blanking viewport GCLOSE Call closes the graphics segment GDELETE Call deletes a graphics segment GDRAW Call draws a polyline GDRAWL Call draws individual lines GGRID Call draws a grid GINCLUDE Call includes a graphics segment GOPEN Call opens a graphics segment GPIE Call draws pie slices GPIEXY Call converts from polar to world coordinates GPOINT Call plots points GPOLY Call draws and fills a polygon GPORT Call defines a viewport GPORTPOP Call pops the viewport GPORTSTK Call stacks the viewport GSCALE Call calculates round numbers for labeling axes GSCRIPT Call writes multiple text strings with special fonts GSET Call sets attributes for a graphics segment GSHOW Call shows a graph GSTART Call initializes the graphics system GSTOP Call deactivates the graphics system GSTRLEN Call finds the string length GTEXT and GVTEXT Calls place text horizontally or vertically on a graph GWINDOW Call defines the data window GXAXIS and GYAXIS Calls draw a horizontal or vertical axis PGRAF Call produces scatter plots WINDOW Statement opens a display window

 Chapter Contents Previous Next Top