Hi all,
I wrote the below code to conduct clustering analysis but for the results, I got class seven name as class seven 0.10.1
Could you please advice with this
Thanks
data stock;
length class $ 27;
input class &$ IH_High IH_Meduim IH_Low US_SH_High_Low US_SH_High_Meduim US_SH_High_Low FM_Low;
datalines;
Class Four 1.3 1.3 1.3 1.2 1.2 1.2 0.8
Class Five 28.1 18.1 28.1 26.4 36.4 46.4 54.7
Class Six 2.8 2.8 2.8 5 5 5 7.8
Class Seven 0.1 0.1 0.1 0.1 0.1 0.1 0.1
Class eight 2.9 2.9 2.9 5 5 5 4.5
Class nine 60 70 60 60 50 40 30
Class ten 0.5 0.5 0.5 0.6 0.6 0.6 1.4
Class eleven 2.7 2.7 2.7 1.2 1.2 1.2 0
Class twelve 1.3 1.3 1.3 0.3 0.3 0.3 0
Class thirteen 0.3 0.3 0.3 0.2 0.2 0.2 0.7
;
proc distance data=stock method=dcorr out=distdcorr;
var interval(IH_High IH_Meduim IH_Low US_SH_High_Low US_SH_High_Meduim US_SH_High_Low FM_Low);
id class;
run;
proc print data=distdcorr;
id class;
title2 'Distance Matrix for 15 Utility Stocks';
run;
title2;
ods graphics on;
/* compute pseudo statistic versus number of clusters and create plot */
proc cluster data=distdcorr method=ward pseudo plots(only)=(psf dendrogram);
id class;
run;
/* compute pseudo statistic versus number of clusters and create plot */
proc cluster data=distdcorr method=average pseudo plots(only)=(psf dendrogram);
id class;
run;
Try inserting an additional space between the Seven and 0.1
When I ran your code there was a single, I believe TAB character. When using LIST input with the & modifier you need to have 2 spaces to indicate the end of a variable.
You will have the same issue with Eight as well I think.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.