It is always important to look at the SAS log to see if there are any WARNING or ERROR messages. For your example, the log says:
data cars;
set sashelp.cars(obs=80); /* use fewer obs */
ModelMake = catx(":", make, model); /* VERY long string! */
MyID = put(_N_, Z3.); /* a shorter string */
run;
/*Standardize data*/
title "Standardize data";
proc standard data=cars mean=0 std=1 out=carsSTD;
var _numeric_;
run;
proc aceclus data=carsSTD out=Ace p=.03 ;
var MPG_Highway MSRP EngineSize Cylinders Horsepower MPG_City Weight Wheelbase
Length;
run;
proc cluster data=Ace method=ward ccc pseudo print=20 out=tree
plots(MAXPOINTS=428)=den(height=rsq);
var can1-can3;
id MyID;
run;
It is always important to look at the SAS log to see if there are any WARNING or ERROR messages. For your example, the log says:
data cars;
set sashelp.cars(obs=80); /* use fewer obs */
ModelMake = catx(":", make, model); /* VERY long string! */
MyID = put(_N_, Z3.); /* a shorter string */
run;
/*Standardize data*/
title "Standardize data";
proc standard data=cars mean=0 std=1 out=carsSTD;
var _numeric_;
run;
proc aceclus data=carsSTD out=Ace p=.03 ;
var MPG_Highway MSRP EngineSize Cylinders Horsepower MPG_City Weight Wheelbase
Length;
run;
proc cluster data=Ace method=ward ccc pseudo print=20 out=tree
plots(MAXPOINTS=428)=den(height=rsq);
var can1-can3;
id MyID;
run;
I am not an expert on clustering, but, yes, that is essentially what I would do. For your data, there is evidence for 3, 6, and 12. If you project the data onto the first few principal components and color by the cluster number, that might help you decide.
When you create a scatter plot, add the GROUP= option. There are examples in the PROC CLUSTER documentation.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.