SPSS command: SPSS CLUSTER

Hierarchical cluster analysis in your browser

Hierarchical clustering starts with every case as its own cluster and merges the two closest clusters at each stage until one remains, so you can see the whole grouping history before choosing how many clusters to keep.

Free · No account · Files stay on your device · Updated 18 October 2026

What it tells you

Crosstabs runs SPSS CLUSTER for cases with seven linkage methods and the interval, count and binary measures of PROXIMITIES.

  • The order in which cases and clusters merge, and the distance or within-cluster sum of squares at each stage.
  • Where a natural cut lies: a sudden jump in the coefficients or a long vertical gap in the dendrogram.
  • Which solution in your range is best separated, from the average silhouette for each number of clusters.
  • Each case's cluster in every solution from the lowest to the highest number you request.

When to use it

Use it when

  • Small to medium files (up to 2,500 cases) where you want to inspect the grouping rather than fix k in advance.
  • Grouping stores, products, countries or respondents on a handful of profile variables, with a dendrogram to show stakeholders.
  • Binary or count data, using measures such as Jaccard, simple matching or the chi-square measure.

Use something else when

  • Thousands of cases: the case-by-case matrix grows with the square of n; use k-means or TwoStep instead.
  • Grouping variables rather than cases: this panel clusters cases; for variables use factor analysis or the Distances matrix between variables.
  • Mixed continuous and categorical variables: TwoStep handles both directly.

How to run it in Crosstabs

  1. 01

    Open Hierarchical cluster

    In Statistics mode, choose Hierarchical cluster (CLUSTER) from the Classify group.

  2. 02

    Choose variables and labels

    Tick the Variables to cluster and pick a Label cases by variable so the dendrogram and membership table show names instead of case numbers.

  3. 03

    Pick the cluster method

    Choose the Cluster method: Between-groups linkage (default), Within-groups linkage, Nearest neighbor, Furthest neighbor, Centroid clustering, Median clustering or Ward's method.

  4. 04

    Set the measure and standardization

    Choose the Data type (Interval, Counts or Binary) and the Measure; Squared Euclidean distance is the default. For interval data pick a Standardize option such as Z scores, by variable or by case.

  5. 05

    Request a range of solutions

    Set Solutions from and Solutions to (2 and 5 by default) to save memberships and silhouettes for each number of clusters in that range, then run.

Worked example

Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.

Try with example data

Data

12 synthetic stores (S01–S12) described by weekly visitors (thousands), average basket and percentage of online orders, generated as three store types with normal noise and a fixed seed. The variables are Z-scored, distances are squared Euclidean, the cluster method is Ward's method, and memberships are saved for 2 to 4 clusters.

Agglomeration Schedule
StageCluster 1Cluster 2CoefficientsStage Cluster First Appears: Cluster 1Stage Cluster First Appears: Cluster 2Next Stage
1390.024008
26120.079008
3250.161006
44100.355007
5170.589007
62110.971309
7141.7015411
8362.6001210
9283.5506010
102313.6479811
111233.0007100

For Ward's method the coefficient is the within-cluster sum of squares.

Cluster Evaluation
ClustersSilhouette measure of cohesion and separation
20.650
30.786
40.777
Cluster Membership
Case2 Clusters3 Clusters4 Clusters
S01111
S02222
S03233
S04111
S05222
S06233
S07111
S08224
S09233
S10111
S11222
S12233

How to read it

Ward's method merges the 12 stores in 11 stages. The coefficient grows slowly at first and then jumps: the last three stages raise it to 3.55, 13.65, 33.00, the elbow that suggests stopping before the final merges. Of the 2-, 3- and 4-cluster solutions, 3 clusters have the highest average silhouette (0.786); in the 3-cluster solution the stores fall into groups of 4, 4, 4.

Output tables explained

Case Processing Summary
Valid, missing and total N, with the measure used; cases missing any clustering variable are excluded listwise.
Dendrogram
The merge tree on SPSS's rescaled distance (0–25). Cut it where the vertical lines are longest to choose the number of clusters.
Agglomeration Schedule
Each stage's merged clusters, the coefficient, the stage at which each cluster first appeared and the next stage. For Ward's method the coefficient is the within-cluster sum of squares; otherwise it is the proximity at which the clusters merged.
Cluster Evaluation
The SPSS centroid-based silhouette for each requested solution: above 0.5 suggests reasonable structure, below 0.2 little structure.
Cluster Membership
One column per solution with each case's cluster number; the CSV export contains every case.

Assumptions and notes

  • Results depend heavily on the measure, the linkage and standardization; variables in different units should usually be standardized.
  • Ward's, centroid and median clustering are meant for squared Euclidean distance.
  • Merges are never undone, so an early poor merge carries through to every later solution.
  • A workspace weight is not applied, and a measure that is undefined for some pair (for example a constant case under correlation) stops the analysis.

How the results are validated

Agglomeration coefficients for all seven linkage methods on squared Euclidean distance, between-groups linkage on a Pearson correlation similarity and complete linkage on Z-scored Euclidean distance agree with SciPy 1.18.1 scipy.cluster.hierarchy within 1e-9 on a 36-case reference set (within-groups linkage, which SciPy lacks, against a brute-force NumPy implementation), and cluster memberships are identical. The silhouette matches an independent implementation of the SPSS Cluster Evaluation formulas to 12 decimals, and the dendrogram is checked to span the 0–25 rescaled range. Validation evidence

Questions

Which linkage method should I use?

Ward's method with squared Euclidean distance gives compact clusters of similar size and is a common default for profiling. Between-groups linkage is more robust to outliers; nearest neighbor tends to chain cases into one long cluster.

How do I decide how many clusters to keep?

Look for the stage where the coefficient in the agglomeration schedule jumps, cut the dendrogram at its longest gap, and compare the silhouettes in Cluster Evaluation. Then check the clusters make substantive sense.

How are clusters numbered?

As in SPSS: in the agglomeration schedule a merged cluster keeps the lower case number, and in Cluster Membership clusters are numbered by first appearance in the file, so case 1 is always in cluster 1.

Can I cluster binary yes/no items?

Yes. Set Data type to Binary, choose a measure such as Jaccard or simple matching, and set which values count as Present and Absent.

Is there a case limit?

Yes, 2,500 cases, because the full proximity matrix is held in memory. For larger files use k-means or TwoStep, or cluster a random sample first.

Run Hierarchical Cluster on your own data

Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.

Open the workspace

SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.