BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jay54
Meteorite | Level 14

Not with SAS 9.2.  When you include a scatter plot with markerchar into the legend, you will get the swatch(s) in the legend of the same color as the markechar.  This is true with any plot.  With SAS 9.3 you have some new options.  Or, you can use the vector plot idea I mentioned in #6 earlier.

John70
Calcite | Level 5

Thanks!  Have a nice weekend.

Jay54
Meteorite | Level 14

Maybe we got too wrapped up in the legend.  All you really need is this.  See INSET statement.

MeanMarker.png

ods graphics / reset width=4in height=3in imagename='MeanMarker';
proc sgplot data=try1 noautolegend;

options orientation=landscape;
xaxis values=(0 to 4 by 1) label='Trt' ;
yaxis values=(-10 to 60 by 10) label="Something" ;
title "";

scatter x = trt y = value / markerattrs=(size=9 symbol=circle color=black) legendlabel="Individual Value" name="Ind";
scatter x = trt y = mean / MARKERCHAR=meanbar legendlabel="--- Mean" name="Mean"; 
scatter x = trt y = median / MARKERCHAR=mednbar legendlabel="xxx Median" name="Med";
inset ("--------" = "Mean" "- - - - -"="Median") / position=topright border;
/*keylegend "Ind" "Mean" "Med"/ title="" position=topright location=inside across=1 ;*/

run;

Natalie
Calcite | Level 5

Dear Sunjay,

Thanks for the tip with the INSET statement (first, I left out the legend as I had same problem as John).

I think vector plot is also a good alternative. On the other hand, I liked the MARKERCHAR option, as it is easy to

use (here is an example of my graph):

natalie.png

Natalie

John70
Calcite | Level 5

Dear Sanjay,

Many thanks for the detailed explanation and statment. I agree with Natalie.  Maybe in the later version of SAS, some line types (e.g. solid line, dash line etc) could be considered to add into the symbol list. So the graph is even more flixable and powerful.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 20 replies
  • 6578 views
  • 0 likes
  • 3 in conversation