Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: cluster analysis with foreach


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: cluster analysis with foreach
Date   Wed, 9 Jun 2010 20:40:17 +0100

Fair point. 

Brevity is not all, however. Saving to a local has the merit that it
remains available for later use, whereas r() results are ephemeral. 

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss

" If you want to do it that way, fine but 

levelsof state, local(allstates) 
foreach s of local allstates { 
	...
} 

is one statement fewer."

Shortest version yet: 


*************
levelsof state
foreach s in `r(levels)'{ 
	...
}
*************


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index