Counting the number of data points: count

Syntax

  • Aggregate syntax

in a Data Set expression

count ( dataset { groupingClause } )

in a Component expression within an aggr clause

count ( component ) { groupingClause }

in a Data Set expression

count ( )

  • Analytic syntax

in a Data Set expression

count ( dataset over( analyticClause ) )

in a Component expression within a calc clause

count ( component over( analyticClause ) )

Input parameters

dataset

the operand Data Set

component

the operand Component

groupingClause

see Aggregate invocation

analyticClause

see Analytic invocation

Semantics for scalar operations

This operator cannot be applied to scalar values.

Input parameters type

dataset

dataset

component

component

Result type

result

dataset { measure<integer> int_var }
| component<integer>

Additional Constraints

None.

Behaviour

The operator returns the number of the input Data Points. For other details, see Aggregate and Analytic invocations.

Examples

Given the operand dataset DS_1:

Input DS_1 (see structure)

Id_1

Id_2

Id_3

Me_1

2011

A

XX

iii

2011

A

YY

jjj

2011

B

YY

iii

2012

A

XX

kkk

2012

B

YY

iii

Example 1

DS_r := count ( DS_1 group by Id_1 );

results in (see structure):

DS_r

Id_1

int_var

2011

3

2012

2

Example 2

DS_r := count ( DS_1 group by Id_1 having count() > 2 );

results in (see structure):

DS_r

Id_1

int_var

2011

3