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: Call for Content

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!

Submit your idea!

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.

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