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

st: unique values

From   "Stephen R. Hale" <>
To   "STATA" <>
Subject   st: unique values
Date   Tue, 7 Jun 2005 12:00:37 -0400

Hi all,

I'm new to the list.  Can anyone direct me to an efficient, preferrably
already existing way to get the unique values of a categorical variable into
a macro.  The goal is just like creating a "by", but I need to have the
unique values list.  Let's say I can get the unique values in the macro

I then want to be able to loop over all unique values in the list

Foreach uniqval of local `uniqlist' {
  execute code



Stephen R. Hale, Ph.D.
Complex Systems Research Center
Institute for Study of Earth, Oceans, and Space
Morse Hall
University of New Hampshire
Durham, NH 03824-3525
Work 603.862.4758
Fax  603.862.0188
Home 603.664.4036

*   For searches and help try:

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