Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ram_SAS
Obsidian | Level 7

 

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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

8 REPLIES 8
Jay54
Meteorite | Level 14

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;

Ram_SAS
Obsidian | Level 7

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.
Jay54
Meteorite | Level 14

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;

Ram_SAS
Obsidian | Level 7
Great. Thanks for the explanation. I am a big fan of your papers and books. Congratulations on your achievements and contributions in this area!
qinghuac
Calcite | Level 5

Hi Sanjay,

Is it possible to use different symbols easily for groups as some of printers can't print color graphs?  If we can associate each group with different shape regardless/in addition to the color code, that would be great.  

 

Best Regards,

Kathy Chen

qinghuac
Calcite | Level 5

sorry.  It worked as we speak.  I found the options.  Thanks much anyway.

Jay54
Meteorite | Level 14

The STYLEATTRS statement can be used to specify the list of colors, symbols and line patters to be used for the groups.

qinghuac
Calcite | Level 5
ods graphics / attrpriority=none; does the trick!
Thanks Sanjay!

BTW, I am working for a different company now. Stay in touch.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 8689 views
  • 2 likes
  • 3 in conversation