Thanks for the reply! I found an approach that worked, I think my use of if / then syntax needs some practice because the same approach was not working until I added do / end. I'm not familiar with sganno, i'm trying to find an example of case where it is used to apply an annotation only to the maximum value. I don't suppose you would know of an example, or a source I can read? An approach I have that seems to work, given the variable names from my previous post as 'colorindex', 'color', 'colorscore' in that order, and being in the dataset 'mydata': *Sort on color score;
proc sort data=mydata;
by descending score;
run;
*create new variable 'colorwithhighestscore' on row 1 with 'if _n_ = 1 then'
(known highest value) only, force blank for all other rows with new variable;
data mydata;
set mydata;
if _n_ = 1 then
do;
colorwithhighestscore = color;
end;
else
do;
colorwithhighestscore = "";
end;
run;
*plot using new variable 'colorwithhighestscore' as label;
proc sgplot data=mydata;
scatter x=colorindex y=colorscore / datalabel=colorwithhighestscore;
run; I'm not sure this is the best approach, only an approach that I could make work. Feedback is very welcome. Thanks in advance!
... View more