Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

AW: st: cluster analysis with foreach


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: cluster analysis with foreach
Date   Wed, 9 Jun 2010 21:47:22 +0200

<> 


That is an obvious problem of my strategy. I was also wondering whether
there might be a limit to the length (i.e. number of levels) in my syntax,
but in terms of -help limits-, both the -local- and the r-return are
probably considered a -macro- and the line
" # of characters in a macro             8,681        165,200
1,081,511"
applies to both...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Nick Cox
Gesendet: Mittwoch, 9. Juni 2010 21:40
An: [email protected]
Betreff: RE: st: cluster analysis with foreach

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

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/


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index