BookmarkSubscribeRSS Feed
Chai_ch
Calcite | Level 5

I am using PROC CLUSTER , ward method to cluster countries (N=214). After I consider CCC to select appropriate number of cluster, I would like to create a new column telling which cluster each country is in. What is the code (or where to click) for creating such variable as a new column in data set?  Thank you. 

2 REPLIES 2
ballardw
Super User

You might try sharing the code you are using.

 

Note the PROC Cluster by default creates relationship trees of values.

 

Perhaps you want to look at Proc FASTCLUS as that generally assigns each value to a single cluster.

stat_sas
Ammonite | Level 13

Hi,

 

Below are the steps to create a cluster variable:

 

/* wards method cluster analysis  */

 

proc cluster data=have method=ward outtree=tree ccc ;

var a b c;

id country;

run;

 

/* PROC TREE prints the tree diagram, also output a data set, called "want" that contains variable containing four clusters --- */

 

proc tree data=tree out=want nclusters=4;

id country;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 804 views
  • 0 likes
  • 3 in conversation