Hi, I'm using EG 7.12 and I have a problem when I use markerattrs. (NBRSUCAGE is the variable with the label names for the graph legend)
Using this code, the legend appears:
proc sgplot data=stats.cuadro; scatter x=var16_17 y=ING17 /group=NBRSUCAGE name="ag"; discretelegend "ag" / title="Agencias"; title "Variación 2016- 2017 vs Ingresos"; run;
But, when I agree the markeratrrbs option, the legend disappears:
proc sgplot data=stats.cuadro;
scatter x=var16_17 y=ING17 /group=NBRSUCAGE markerattrs=(symbol=circlefilled size=3pct) name="ag";
discretelegend "ag" / title="Agencias";
title "Variación 2016- 2017 vs Ingresos";
run;
How could I maintain the changes without losing the legend?
Also, It would be a plus if there is any way to have different symbols for markers without coding a previous template. Thank you very much!
1: What are you trying to accomplish with the DISCRETELEGEND Statement?
2: You can use different symbols for markers without coding a previous template by setting the ATTRPRIORITY=NONE in the ODS GRAPHICS Statement and use the STYLEATTRS Statement as in the following small example
ods graphics on / attrpriority=none;
proc sgplot data=sashelp.iris noautolegend;
styleattrs datasymbols=(circlefilled squarefilled starfilled) ;
scatter x=sepallength y=sepalwidth / group=species;
keylegend / location=inside position=NE across=1;
run;
1: What are you trying to accomplish with the DISCRETELEGEND Statement?
2: You can use different symbols for markers without coding a previous template by setting the ATTRPRIORITY=NONE in the ODS GRAPHICS Statement and use the STYLEATTRS Statement as in the following small example
ods graphics on / attrpriority=none;
proc sgplot data=sashelp.iris noautolegend;
styleattrs datasymbols=(circlefilled squarefilled starfilled) ;
scatter x=sepallength y=sepalwidth / group=species;
keylegend / location=inside position=NE across=1;
run;
Use the KEYLEGEND Statement and alter the POSITION= and LOCATION= Options to put the legend where you want it
Hi draycut, I checked the keylegend statement, got better output, but I have the same problem when I included the markerattrs option. After many changes, I realize that the problem appears when you use pct as measure for the size marker, I changed it to mm and the legend appears. Thanks!!!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.