Bookmark and Share

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

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

st: cluster analysis with foreach

From   Maximiliano Manuel Silva Correa <>
Subject   st: cluster analysis with foreach
Date   Wed, 9 Jun 2010 12:36:00 -0400

Dear Stata community

Im stuck trying to run a cluster analysis routine throuth diferent
sections of my data. Suppose we have power consumtion data about
different cities of the US. What I'd like to do is to run a cluster
analysis routine (cluster kmeans for example) by state, because i
would like to see in every state which cities have similar power

It would be something like

foreach s in states{

cluster(kmeans, power_city)


(states is a string variable)

Could someone show me the sintax here, or send similar examples?

Any help will be greatly appreciated. Thank you in advance,

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index