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

st: unique values


From   "Stephen R. Hale" <[email protected]>
To   "STATA" <[email protected]>
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
uniqlist.

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

Foreach uniqval of local `uniqlist' {
  execute code
}

Thanks,

Steve

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
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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