BookmarkSubscribeRSS Feed
saslove
Quartz | Level 8

Hi. I am doing a Cluster analysis. I ended up doing Hierarchial Clustering by

Wards method for my binary(dichotomous) variables dataset.

I would like to know how I can get a scatter plot showing the three clusters

neatly in different symbols and colors. I am struggling with this. Can you

please help me.

Thanks

PNS

3 REPLIES 3
ieva
Pyrite | Level 9

Could this help you?

SYMBOL1 V=circle C=black;

SYMBOL2 V=star   C=red;

SYMBOL3 V=diamond C=blue;

   proc gplot data=test;

      plot var2*var1=Cluster;

   run;

More info about symbol statement on:

http://www.psych.yorku.ca/lab/sas/sgsumry5.htm

saslove
Quartz | Level 8

Hello

I tried doing this, but I need a cluster plot with all the 33 variables shown across the plot on three different clusters. I have no idea how I should be plotting this. ? Could someone help?

Thanks

PGStats
Opal | Level 21

With binary data, assuming no missing values, all you can show is the number of observations having each variable's state in every cluster, i.e. the strength or importance of each variable in the clusters. You could do this with three horizontal bar graphs side by side. Something along the lines of:

/* Assuming dataset myData contains variables
id: unique observation id,
clusId: cluster to which the observation belongs,
v1 to v33: dichotomous variables with values 0 or 1 */

proc sort data=myData; by clusId id; run;

proc transpose data=myData out=myTData name=myVariable;
var v1--v33;
by clusId id;
run;

ods graphics on;
proc sgpanel data=myTData;
panelby clusId / layout=columnlattice;
hbar myVariable / response=col1 stat=sum;
run;

Good luck.

PG

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1581 views
  • 0 likes
  • 3 in conversation