14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8 Programming Methods 197<br />

Lists and Expressions<br />

Table 8.4 Functions for manipulating lists or expressions (Continued)<br />

Function Syntax Explanation<br />

Insert<br />

Into<br />

Shift<br />

Shift Into<br />

Reverse<br />

Reverse<br />

Into<br />

Sort List<br />

Sort List<br />

Into<br />

Sort<br />

Ascending<br />

Sort<br />

Descendin<br />

g<br />

Insert<br />

Into(list|expr,<br />

item, position)<br />

Insert<br />

Into(list|expr,<br />

item)<br />

x = Shift(list|expr)<br />

x = Shift(list|expr,<br />

n)<br />

Shift<br />

Into(list|expr)<br />

Shift<br />

Into(list|expr, n)<br />

x=Reverse(list|expr<br />

)<br />

Reverse<br />

Into(list|expr)<br />

x=Sort<br />

List(list|expr)<br />

Sort List<br />

Into(list|expr)<br />

Sort<br />

Ascending(list|matr<br />

ix)<br />

Sort<br />

Descending(list|mat<br />

rix)<br />

Same as insert, but does it in place. List or expression must be<br />

an L-value.<br />

Shift an item or n items from the front to the back of the list<br />

or expression. Shift items from back to front if n is negative.<br />

Shift items in place.<br />

Reverse the order of elements of a list or terms of an<br />

expression.<br />

Reverse the order of elements of a list or terms of an<br />

expression in place.<br />

Sort the elements of a list or the terms of an expression.<br />

Numbers sort low, followed by the name value of names,<br />

strings, or operators. For example 1+2 is lower than 1-2<br />

because the name value Add sorts lower than the name value<br />

Subtract. {1,2} sorts lower than {1,3}, which sorts lower than<br />

{1,3,0}. {1000} sorts lower than {“a”}, but {a} and {“a”} sort as<br />

equal.<br />

Sort the elements of a list or terms of an expression in place.<br />

Returns a copy of a list or matrix with the items in ascending<br />

order.<br />

Returns a copy of a list or matrix with the items in<br />

descending order.<br />

Loc Sorted Loc Sorted(A, B) Creates a matrix of subscript positions where the values in<br />

matrix A match the values in matrix B. A must be a matrix<br />

sorted in ascending order.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!