Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: number of unique values within an observation

From   "Scott Imberman" <>
To   <>
Subject   st: number of unique values within an observation
Date   Fri, 30 Sep 2005 14:56:55 -0400

Dear Statalist,

I was wondering if there is s a simple way to count the number of
unique values in a variable list for each observation.  For example, i
am looking at the id numbers for colleges that a set of student attends.
 A student may list having attended a college in multiple years like

year     id

1995     3
1996     2
1997     3
1998     3

I want to know how many unique schools the student attended (in this
example the answer is 2).  Thanks for your help.


Scott Imberman

Scott Andrew Imberman

Department of Economics
3105 Tydings Hall, University of Maryland
College Park, MD 20742
Voice: (301) 405-4534
Fax: (301) 405-3542

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index