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.

146 Data Structures Chapter 7<br />

Matrices<br />

Transpose<br />

1 0 1 4 4 4]<br />

The VConcat() function stacks two matrices on top of each other to form a larger matrix. The number of<br />

columns must agree. A vertical-bar-slash ( |/ ) is the infix operator, equivalent for vertical concatenation.<br />

Identity(2) |/ J(3,2,1); // or VConcat(Identity(2),J(3,2,1));<br />

[1 0,<br />

0 1,<br />

1 1,<br />

1 1,<br />

1 1]<br />

Both Concat() and VConcat() support concatenating to empty matrices, scalars, and lists.<br />

a=[];<br />

a || [1]; // yields [1]<br />

a || {2}; // yields [2]<br />

a || [3 4 5]; // yields [3 4 5]<br />

There are two in place concatenation operators: ||= and |/= . They are equivalent to the Concat<br />

To()and V Concat To() functions, respectively.<br />

• a||=b is equivalent to a=a||b<br />

• a|/=b is equivalent to a=a|/b<br />

The Transpose() function transposes the rows and columns of a matrix. A back-quote ( ` ) is the postfix<br />

operator, equivalent to Transpose(). In matrix notation, Transpose() is expressed as the common<br />

prime or superscript-T notation ( A′ or A T ).<br />

A=[1 2 3, 4 5 6, 7 8 9, 10 11 12];<br />

A`;<br />

[1 4 7 10,<br />

2 5 8 11,<br />

3 6 9 12]<br />

Transpose([1 2,3 4]);<br />

[1 3,<br />

2 4]<br />

Matrices and Data Tables<br />

You can move information between a matrix and a JMP data table. You can use matrix algebra to perform<br />

calculations on numbers that are stored in JMP data tables, and you can save the results back to JMP data<br />

tables.<br />

Move Data into a Matrix from a Data Table<br />

These sections describe how to move data from a data table into a matrix.

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

Saved successfully!

Ooh no, something went wrong!