Dataset 1 will produce a dendrogram, but dataset 2 will not. Why is that, considering the numerical values are the same in both sets?
Set 1
Data PAHcSta;
Input station $ Ace Ant Benzoaa Benzoap Benzobf Benzoghi Benzok Chry Bibenzo Fluora Fluore Indeno Phen Pyr;
datalines;
WR2e1Jy 0 0 0 0 0.0083 0 0 0 0 0 0 0 0.00554 0
WR2e2Jy 0 0 0.00665 0.00665 0.0104 0 0.00475 0.00665 0 0.0152 0 0 0.0076 0.0133
WR2e3Jy 0 0 0.0112 0.0112 0.0168 0.0084 0.0056 0.00933 0.00653 0.0187 0 0.0112 0.0056 0.0187
WR2s3Jn 0 0 0 0.00527 0.0079 0 0 0.00527 0 0.00878 0 0 0.00439 0.00878
WR2s2Jn 0 0 0 0 0.0125 0 0 0.00891 0 0.016 0 0 0.00891 0.016
WR2s1Jn 0 0 0.03 0.045 0.065 0 0 0 0 0.04 0 0 0.03 0.06
;
Proc cluster method=average;
id station;
Run;
Proc tree data=tree;
id station;
Run;
Set 2
Data PAHcSta;
Input station $13 Ace Ant Benzoaa Benzoap Benzobf Benzoghi Benzok Chry Bibenzo Fluora Fluore Indeno Phen Pyr;
datalines;
eWR24sJy 0 0 0 0 0.0083 0 0 0 0 0 0 0 0.00554 0
eWR24sJy 0 0 0.00665 0.00665 0.0104 0 0.00475 0.00665 0 0.0152 0 0 0.0076 0.0133
eWR26sJy 0 0 0.0112 0.0112 0.0168 0.0084 0.0056 0.00933 0.00653 0.0187 0 0.0112 0.0056 0.0187
bWR27saJn 0 0 0 0.00527 0.0079 0 0 0.00527 0 0.00878 0 0 0.00439 0.00878
bWR27sbJn 0 0 0 0 0.0125 0 0 0.00891 0 0.016 0 0 0.00891 0.016
bWR27scJn 0 0 0.03 0.045 0.065 0 0 0 0 0.04 0 0 0.03 0.06
;
Proc cluster method=average;
id station;
Run;
Proc tree data=tree;
id station;
Run;
Your second data set has two rows for which station="eWR24sJy". The row identifiers must be unique. You should see a WARNING In the log that says
WARNING: The DENDROGRAM will not be drawn because the NODEID
values are not unique.
In later versions of SAS, we added dendrograms directly to proc cluster. Do you even need proc tree?
Correct. With ODS GRAPHICS ON, the dendrogram is produced by PROC CLUSTER.
I'll also mention that the second DATA step doesn't seem to work as posted.
One way to fix it is to use a LENGTH statement and remove the $13 token from the INPUT statement:
length station $13;
Input station Ace Ant ...;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.