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

st: unique values


From   "Stephen R. Hale" <srhale@garnet.sr.unh.edu>
To   "STATA" <statalist@hsphsun2.harvard.edu>
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
steve.hale@unh.edu

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index