BookmarkSubscribeRSS Feed
sdhilip
Quartz | Level 8

Hi

 

I am doing K-Means clustering in SAS Guide. I have 8950 observations and 21 variables. I chose 6 clusters, but unable to get proper cluster plot. Below my code. Please advise

 

proc fastclus data=cluster maxclusters=6 out =  clust;
var BALANCE--PAYMENT_MINPAY;
run;

proc sort;
by cluster distance;
run;

proc print;
by Cluster;
run;

proc freq data=work.clust; tables cust_id*cluster / nocol nopercent; run;

proc candisc out = can; 
class cluster; 
var BALANCE	--PAYMENT_MINPAY;
run;

proc sgplot data = can; 
title "Cluster Analysis for Bank datasets"; 
scatter y = can2 x = can1 / group = cluster; run;

I chose K = 6 randomly. Anyone can suggest how to choose K in K Means clustering at SAS. I check the elbow method for selecting clusters in Python. No idea how to do it SAS? I am getting good cluster graph for the same dataset in Python.

1 REPLY 1

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 4023 views
  • 0 likes
  • 2 in conversation