centroid ^varlist^ if ^exp^ in ^exp^ [weight], group(^groupvar^) [dist(#)]
The program ^centroid^ takes as input a set of variables and a grouping variable, which is designated ^groupvar^. ^Groupvar^ indicates into which group each case falls. As output, it generates a set of group ^centroids^, which are means of each variable in ^varlist^, and a set of distances, which indicate how far each case is from each centroid.
Output is as follows: Let g be the number of levels of ^groupvar^. Let v be the number of variables in ^varlist^.
CENTij, for i=1,...,g;j=1,...,v: The mean of the ith group on the jth variable.
DISTi, for i=1,...g: The distance of each case from the ith centroid.
Distance option --------------- "Distance" is calculated by the Minkowski metric with parameter specified by the dist(#) option. If you do not specify this option, Euclidean distance is assumed (#=2). Allowable values are greater than or equal to 1.
Author's contact information is in the ado file.