I'm trying to plot two variables and by using different colors/signs to plot the points belonging to three different classes.
Code :
ods graphics / reset width=6.4in height=4.8in imagemap;
proc sgplot data=WORK.FINALWINEDATA;
scatter x=Alcohol y=Total_phenols / group=Class
markerattrs=(symbol=circlefilled size=10);
xaxis grid;
yaxis grid;
run;
ods graphics / reset;
But when i'm trying add more symbol, i get below error message
The STYLEATTRS statement will override default color and style cycling.
Blog entry "Attrs, attrs, everywhere: The interaction between ATTRPRIORITY, CYCLEATTRS, and STYLEATTRS in ODS g... covers the topic in more detail.
data have;
do x = 0 to 20 by .25;
class = 'A';
y = sin(x+5);
output;
class = 'B';
y = 2 + 2 * sin(x/2);
output;
class = 'C';
y = 6 + 3 * sin(x/1.25);
output;
end;
run;
ods html file='series.html';
ods graphics / attrpriority=none;
proc sgplot data=have;
scatter x=x y=y /
group=class
;
styleattrs
datacontrastcolors = ( black red purple )
datasymbols = ( circlefilled trianglefilled diamondfilled )
;
run;
ods html close;
The STYLEATTRS statement will override default color and style cycling.
Blog entry "Attrs, attrs, everywhere: The interaction between ATTRPRIORITY, CYCLEATTRS, and STYLEATTRS in ODS g... covers the topic in more detail.
data have;
do x = 0 to 20 by .25;
class = 'A';
y = sin(x+5);
output;
class = 'B';
y = 2 + 2 * sin(x/2);
output;
class = 'C';
y = 6 + 3 * sin(x/1.25);
output;
end;
run;
ods html file='series.html';
ods graphics / attrpriority=none;
proc sgplot data=have;
scatter x=x y=y /
group=class
;
styleattrs
datacontrastcolors = ( black red purple )
datasymbols = ( circlefilled trianglefilled diamondfilled )
;
run;
ods html close;
Issue Resolved!
I used below refer code to fix my issue.
ods graphics on / attrpriority=color; proc sgplot data=sashelp.iris aspect=1; scatter x=petalwidth y=sepalwidth / group=species; keylegend / location=outside position=right across=1; run; |
ods graphics on / attrpriority=none; proc sgplot data=sashelp.iris aspect=1; styleattrs datasymbols=(trianglefilled circlefilled squarefilled); scatter x=petalwidth y=sepalwidth / group=species; keylegend / location=outside position=right across=1; run;
Reference Link : https://blogs.sas.com/content/graphicallyspeaking/2018/10/08/getting-started-with-sgplot-part-13-sty...
Regards
Lokesh
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.