Page 1 of 1

UNIQUEVALUES—Extracts an ordered set of unique values

Posted: Wed Jun 29, 2011 11:59 am
by TomDoan
This procedure returns a vector of sorted unique values for an input series over an indicated range.
uniquevalues.src
Procedure file
(1.07 KiB) Downloaded 1047 times
@UniqueValues(values=VECTOR,other options) series start end

Options

values=VECTOR of values found in the series [required]
smpl=dummy with 0's in entries to skip [not used]

The following shows it in use. The data set (from Greene's Econometric Analysis) is an unbalanced panel, with individuals indexed by the "ID" series. UniqueValues generates a sorted list of the individuals into the VECTOR named VID.

Code: Select all

open data rwm.txt
data(format=free,org=columns) 1 27326 id female year age hsat handdum $
 handper hhninc hhkids educ married haupts reals fachhs abitur univ $
 working bluec whitec self beamt docvis hospvis public addon
@uniquevalues(values=vid) id