Data visualization with SAS programming

How to change the default Symbol for Grouped Data in Proc SGPLOT scatter statement

Accepted Solution Solved
Reply
Contributor
Posts: 20
Accepted Solution

How to change the default Symbol for Grouped Data in Proc SGPLOT scatter statement

 

proc sgplot data=sashelp.class;
  scatter x=height y=weight / group=sex ;
run;

In SAS Studio, I get blue circle for M and red circle for F.  Sometimes I can't see if two points are in the same location, as you can see in the following link.

https://support.sas.com/documentation/cdl/en/grstatproc/62603/HTML/default/viewer.htm#a003111460.htm

 

Ram

 


Accepted Solutions
Solution
‎09-24-2016 03:11 PM
SAS Super FREQ
Posts: 1,141

Re: How to change the default Symbol for Grouped Data in Proc SGPLOT scatter statement

With SAS Studio, don't specify the ODS HTML statement like I showed in my code.  Just use the STYLEATTRS to set the group marker symbols.  The PDF or RTF output should show the different markers.  To see different markers in HTML, use ODS GRAPHICS / ATTRPRIORITY=none.

 

ods graphics / attrpriority=none;

proc sgplot data=sashelp.class;
styleattrs datasymbols=(circlefilled trianglefilled);
scatter x=height y=weight / group=sex ;
run;

View solution in original post


All Replies
SAS Super FREQ
Posts: 1,141

Re: How to change the default Symbol for Grouped Data in Proc SGPLOT scatter statement

With SAS 9.4, you can use the STYLEATTRS statement to specify the group symbols, colors and line patterns.

Note, you need a style like LISTING to see different symbols.

 

ods html style=listing;
proc sgplot data=sashelp.class;
styleattrs datasymbols=(circlefilled trianglefilled);
scatter x=height y=weight / group=sex ;
run;

Contributor
Posts: 20

Re: How to change the default Symbol for Grouped Data in Proc SGPLOT scatter statement

Thanks for your reply Sanjay.  ODS destination gives some error in SAS Studio.

 
ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/sashtml24.htm.
ERROR: No body file. HTML output will not be created.
Solution
‎09-24-2016 03:11 PM
SAS Super FREQ
Posts: 1,141

Re: How to change the default Symbol for Grouped Data in Proc SGPLOT scatter statement

With SAS Studio, don't specify the ODS HTML statement like I showed in my code.  Just use the STYLEATTRS to set the group marker symbols.  The PDF or RTF output should show the different markers.  To see different markers in HTML, use ODS GRAPHICS / ATTRPRIORITY=none.

 

ods graphics / attrpriority=none;

proc sgplot data=sashelp.class;
styleattrs datasymbols=(circlefilled trianglefilled);
scatter x=height y=weight / group=sex ;
run;

Contributor
Posts: 20

Re: How to change the default Symbol for Grouped Data in Proc SGPLOT scatter statement

Great. Thanks for the explanation. I am a big fan of your papers and books. Congratulations on your achievements and contributions in this area!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 480 views
  • 1 like
  • 2 in conversation