r_cnt(C;S)

Returns the number of columns within a given set of columns.

Function type

Vector only

Syntax

r_cnt(C;S)

Input

Argument Type Description
C any A space- or comma-separated list of column names

C may also be a string expression (in single quotes) constituting a pattern for matching columns. For instance, 'foo*' specifies all columns that begin with "foo".

If C is omitted, the values in all of the columns are included.

S integer A boolean column or an expression in rcv_/rcn_/rct_ which determines whether or not that column is selected to be included in the calculation. See System variables for more information about rcv_/rcn_/rct_.

If S is omitted, all columns will be considered by the function (subject to any prior column selections).

Return Value

For each row of the table, r_cnt returns an integer value corresponding to the number of columns specified by C.

Sample Usage

c1 c2 c3 c4 r_cnt(;) r_cnt(c1 c2;)
2 5 7 2 4 2
7 7 4 1 4 2
NA 0 9 3 4 2
NA NA NA NA 4 2