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.

662 JSL Syntax Reference Appendix A<br />

Row Functions<br />

Row Functions<br />

Count(from, to, step, times)<br />

Description<br />

Used for column formulas. Creates row by row the values beginning with the from value and ending<br />

with the to value. The number of steps specifies the number of values in the list between and<br />

including the from and to values. Each value determined by the first three arguments of the count<br />

function occurs consecutively the number of times that you specify. When the to value is reached,<br />

count starts over at the from value. If the from and to arguments are data table column names, count<br />

takes the values from the first row only. Values in subsequent rows are ignored.<br />

Returns<br />

The last value.<br />

Arguments<br />

from Number, column reference, or expression. Count starts counting with this value.<br />

to Number, column reference, or expression. Count stops counting with this value.<br />

step Number or expression. Specifies the number of steps to use to count between from and to,<br />

inclusive.<br />

times Number or expression. Specifies the number of times each value is repeated before the next step.<br />

Examples<br />

For Each Row(:colname[row()]=count(0, 6, 3, 1))<br />

//The rows in the column named colname are filled with the series 0, 3, 6, 0,<br />

... until all rows are filled.<br />

For Each Row(:colname[row()]=count(0, 6, 3, 2))<br />

//The rows in the column named colname are filled with the series 0, 0, 3, 3,<br />

6, 6, 0, ... until all rows are filled.<br />

Note<br />

Count() is dependent on Row(), and is therefore mainly useful in column formulas.<br />

Dif(col, n)<br />

Description<br />

Calculates the difference of the value of the column col in the current row and the value n rows previous<br />

to the current row.<br />

Returns<br />

The difference.<br />

Arguments<br />

col A column name (for example, :age).<br />

n A number.

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

Saved successfully!

Ooh no, something went wrong!