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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3992 views
  • 0 likes
  • 2 in conversation