Hello,
I was trying to find the sas code to switch the legend from numbers to my actual variables. I have looked around for the code but I have been unsuccessful.
Data PKHcSta;
Input station $13 Ace Ant Benzoaa Benzoap Benzobf Benzoghi Benzok Chry Bibenzo Fluora Fluore Indeno Phen Pyr;
datalines;
F5sJuly 0 0 0 0 0.5 0 0 0 0 0.00752 0 0 0.009 0.00658
F6sJuly 0 0 0 0 0.00687 0 0 0 0 0.00785 0 0 0 0.00589
F7saJune 0 0 0 0 2 0 0 0 0 0.0147 0 0 0.0129 0.0147
F7sbJune 0 0 0 0 0 0 0 0 0 0 0 0 0 0
F7scJune 0 0 0 0 0 0 0 0 0 0 0 0 0.0198 0
LC45July 0 0 0.0672 1 0.0776 0.0259 0.031 0.0517 0 0.124 0 0.0362 0.0466 0.109
LC5July 0 0.0049 0.0284 0.0206 0.0362 0 0.0137 0.0392 0 0.0392 0 0.00881 0.0311 0.0313
LCJuly 0 0 0.00965 0.00869 0.0164 0 0.00676 0.0145 0 0.028 0 0 0.0116 0.0212
LC7sJune 0.0084 0 0.0056 0 0.00466 0 0 0 0 0 0.0121 0 0 0.0121
LC8June 0 0 0 0 0 0 0 0 0 0.007 0 0 0.006 0.005
LC9saJune 0 0 0.00469 0.00562 0.00843 0 0 0.00562 0 0.0103 0 0 0.0075 0.0122
LC9June 0 0 0 0 0.00984 0 0 0.00615 0 0.0123 0 0 0.00738 0.00984
LC9scJune 0 0 0 0 0.012 0 0 0.01 0 0 0.016 0 0.012 0.016
P1 0 0 0 0 0 0 0 0 0 0 0 0 0.0121 0
P2s 0 0 0 0 0 0 0 0 0 0 0 0 0 0
P3s 0 0 0 0 0 0 0 0 0 0 0 0 0.00591 0
RJ4sJuly 0.0149 0.0128 0.0234 0.017 0.0256 0 0 0.0234 0 0.0597 0.0107 0.0107 0.0192 0.0767
RJ5sJuly 0 0 0 0 0 0 0 0 0 0.00564 0 0 0.00658 0.0047
RJ6sJuly 0 0 0 0 0 0 0 0 0 0 0 0 0 0
RJ7saJune 0 0 0 0 0.00233 0 0 0 0 0.002 0 0 0 0.00233
RJ7sbJune 0 0 0 0 0 0 0 0 0 0 0 0 0 0
RJ7scJune 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Th4sJuly 0 0 0 0 0.0083 0 0 0 0 0 0 0 0.00554 0
Th5sJuly 0 0 0.00665 0.00665 0.0104 0 0.00475 0.00665 0 0.0152 0 0 0.0076 0.0133
Th6sJuly 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
Th7saJune 0 0 0 0.00527 0.0079 0 0 0.00527 0 0.00878 0 0 0.00439 0.00878
Th7sbJune 0 0 0 0 0.0125 0 0 0.00891 0 0.016 0 0 0.00891 0.016
Th7scJune 0 0 0.03 0.045 0.065 0 0 0 0 0.04 0 0 0.03 0.06
WR1July 0.0126 0.0231 0.12 0.0525 0.0693 0.0189 0.0273 0.0672 0 0.433 0 0.0273 0.0441 0.267
;
ods graphics on;
proc varcluster data=PKHcSta outtree=Tree average maxcluster=4 plots=dendrogram;
var Ace--Pyr;
run;
@rjinks wrote:I was trying to find the sas code to switch the legend from numbers to my actual variables.
I'm not fully sure what you mean. Can you show an example of:
Before you do that, there are three problems with your code:
1. Your Data step needs an adjustment or you won't read the data correctly. Instead of of "$13." on your INPUT statement for the Station variable, just use a "$" and add a LENGTH statement with $13. Like this:
Data PKHcSta;
LENGTH Station $13;
INFILE DATALINES MISSOVER;
Input station $ Ace Ant Benzoaa Benzoap Benzobf Benzoghi Benzok Chry Bibenzo Fluora Fluore Indeno Phen Pyr;
2. Also, the name of the procedure is not VARCLUSTER. The correct procedure name is VARCLUS.
3. Lastly, AVERAGE, as you have coded it, is not valid.
These three code problems need to be addressed before we can really work on getting what you want.
Jim
@rjinks wrote:I was trying to find the sas code to switch the legend from numbers to my actual variables.
I'm not fully sure what you mean. Can you show an example of:
Before you do that, there are three problems with your code:
1. Your Data step needs an adjustment or you won't read the data correctly. Instead of of "$13." on your INPUT statement for the Station variable, just use a "$" and add a LENGTH statement with $13. Like this:
Data PKHcSta;
LENGTH Station $13;
INFILE DATALINES MISSOVER;
Input station $ Ace Ant Benzoaa Benzoap Benzobf Benzoghi Benzok Chry Bibenzo Fluora Fluore Indeno Phen Pyr;
2. Also, the name of the procedure is not VARCLUSTER. The correct procedure name is VARCLUS.
3. Lastly, AVERAGE, as you have coded it, is not valid.
These three code problems need to be addressed before we can really work on getting what you want.
Jim
Thank you for the suggestions on correcting the errors.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.