Command Reference : Function Reference : Function Reference: D
  
 
@dupselem
Duplicate identifier within group.
Identifier for the observation within the duplicate group, enumerating observations with the same values.
Syntax: @dupselem(x1,[x2, x3, ... ], [s])
x: series, alpha, group, vector, matrix
x#: series, alpha, group, vector, matrix
s: (optional) sample string or object when the x are series, alpha, and groups and assigning to series
Return: series, vector
For series, alpha, and groups, a duplicate is defined as two observations having identical values for all of variables given by the arguments.
For vectors and matrix objects, a duplicate is defined as two row identifiers having identical values in each of the vector and matrix objects given by the arguments.
Once sets of duplicates are identified, the observations or rows within each set are enumerated. For a set consisting of n duplicated values, the enumerated values are simply the integer values from 1 to n.
Examples
Let X be a series of length 10 that alternates between 0 and 1. Then
show @dupselem(x)
will display a series whose observations are 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, which enumerates the observations that share a common X value.
Let MAT be a matrix whose rows correspond to different observations. Then
vector delems = @dupselem(mat)
is a (column) vector of within-group observation IDs.
Cross-references
See @dupsid and @dupsobs.
See also @uniquevals.