UNIQUEVALUES - Extracts an ordered set of unique values

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.

UNIQUEVALUES - Extracts an ordered set of unique values

Postby TomDoan » Wed Jun 29, 2011 11:59 am

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 37 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
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Return to RATS Procedures

Who is online

Users browsing this forum: No registered users and 2 guests