Chapter Contents

Previous

Next
Data Form and Data Table: _keyCount

Data Form and Data Table: _keyCount



Returns the number of rows that meet the current index key

Delegated to: Data Set Model class


Syntax
Details
See Also

Syntax

CALL SEND (object-id, '_keyCount', rc, count);

Argument Type
Description
rc
N returns whether the count was successful


0 count was successful


not 0 otherwise
count
N returns the number of rows in the table that match the current index key that is specified with the _setKey method


Details

The _keyCount method returns the number of rows that meet the criteria specified by the index key column. The index key column is specified with the last _setKey method used on the table. After the _keyCount method executes, the table is positioned at the first row that meets the criteria defined by the last _setKey method.

The _keyCount method sets SYSRC for error, note, and warning conditions.

CAUTION:
Using the _keyCount method with composite keys may show a larger number of rows matching the search criteria than you expect. Using a composite key with the _setKey method operates the same way as the _where method only when the condition is EQ. The value returned when the condition is EQ is the same as if the columns specified in the composite key were connected by WHERE conditions that use AND or ALSO.

For all other conditions (GT, GE, LT, or LE) specified with _setKey for a composite key, the composite key columns are concatenated together to form the index key. The number returned by the _keyCount method is the number of rows in the table that satisfy the composite key. For example, if the composite index consists of columns SEX and AGE and the condition is GT (greater than), the values to search for are concatenated such that key values of F for SEX and 13 for AGE yield an index key of F13. Because the search is performed on the concatenated values, some values may meet the search condition that you did not expect, such as SEX of M and AGE of 11, because the string M11 is considered greater than the string F13.  [cautionend]


See Also

_setKey


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.