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.

290 Data Tables Chapter 9<br />

Row State Operators<br />

choices are 0, 1, 2, ..., 84; 0–15 for the basic colors, 16–31 for dark shades of the same colors, 32–47 for<br />

light shades, 48–63 for very dark shades, 64–79 for very light shades, and 80–84 for shades of gray.<br />

Values outside the range 0 to 84 are undefined. For best results, use Modulo or other operators to enforce<br />

valid values.<br />

Missing values result in no row state.<br />

An Overview of Row State Operators<br />

From JSL, you can get or set row states directly using the Row State operator. You can get or set the state<br />

for row n with Row State(n). If you do not supply an argument, you set or get the current row. To work<br />

with all rows, either use a For Each Row loop or else work with formula columns. Continuing the example<br />

with the data table just created:<br />

rowstate(1); // returns row state for row 1<br />

Color State(1)<br />

row()=8;rowstate(); // returns row state for current (8th) row<br />

Color State(8)<br />

for each row(print(rowstate()));<br />

Color State(1)<br />

Color State(2)<br />

Color State(3)<br />

Color State(4)<br />

Color State(5)<br />

Color State(6)<br />

Color State(7)<br />

Color State(8)<br />

Color State(9)<br />

Color State(10)<br />

To get a row state and store it in a global, place Row State() on the right side of an assignment:<br />

::x=rowstate(1); // puts the row state of row 1 in x, a global<br />

row()=8;::x=rowstate(); // puts the row state of the 8th row in x<br />

show(x);<br />

x = Color State(8)<br />

// put row states in rscol, a row state column<br />

dt

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

Saved successfully!

Ooh no, something went wrong!