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!!!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: