BookmarkSubscribeRSS Feed
rjinks
Obsidian | Level 7

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;

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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.

WarrenKuhfeld
Ammonite | Level 13

In later versions of SAS, we added dendrograms directly to proc cluster. Do you even need proc tree?

Rick_SAS
SAS Super FREQ

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 ...;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 736 views
  • 2 likes
  • 3 in conversation