14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A JSL Syntax Reference 637<br />

Matrix Functions<br />

Random Index(n, k)<br />

Description<br />

Returns a k by 1 matrix of random integers between 1 and n with no duplicates.<br />

Random Shuffle(matrix)<br />

Description<br />

Returns the matrix with the elements shuffled into a random order.<br />

Rank Index(vector)<br />

Rank(vector)<br />

Description<br />

Returns a vector of indices that, used as a subscript to the original vector, sorts the vector by rank.<br />

Excludes missing values. Lists of numbers or strings are supported in addition to matrices.<br />

Ranking(vector)<br />

Description<br />

Returns a vector of ranks of the values of vector, low to high as 1 to n, ties arbitrary. Lists of numbers<br />

or strings are supported in addition to matrices.<br />

Ranking Tie(vector)<br />

Description<br />

Returns a vector of ranks of the values of vector, but ranks for ties are averaged. Lists of numbers or<br />

strings are supported in addition to matrices.<br />

Shape(A, nrow, )<br />

Description<br />

Reshapes the matrix A across rows to the specified dimensions. Each value from the matrix A is placed<br />

row-by-row into the re-shaped matrix.<br />

Returns<br />

The reshaped matrix.<br />

Arguments<br />

A a matrix<br />

nrow the number of rows that the new matrix should have.<br />

ncol optional. The number of columns the new matrix should have.<br />

Notes<br />

If ncol is not specified, the number of columns is whatever is necessary to fit all of the original values of<br />

the matrix into the reshaped matrix.<br />

If the new matrix is smaller than the original matrix, the extra values are discarded.<br />

If the new matrix is larger than the original matrix, the values are repeated to fill the new matrix.

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

Saved successfully!

Ooh no, something went wrong!