BookmarkSubscribeRSS Feed
vraj1
Quartz | Level 8

I am using proc sgplot and i need sybols in graph as for one treatment as 1 and other treatment as 2 and other treatment as P.

How can i do it using sgplot

9 REPLIES 9
DanH_sas
SAS Super FREQ

What version of SAS are you using?

vraj1
Quartz | Level 8

SAS 9.4

DanH_sas
SAS Super FREQ

Are you scatter plots grouped or overlaid? It might be helpful to see a snippit of the SGPLOT code.

vraj1
Quartz | Level 8

Attached a layout. in this instaed of circle i need '1' and instead of '*' i need as '2' and other one as 'P' may be.


Capture.JPG
DanH_sas
SAS Super FREQ

The reason I need to know if your SGPLOT code is using groups versus overlays is that it will make a difference in the solution. Is your plot statement using the GROUP option, or are you using three plot statements?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

In 9.4 there is an option symbol=, for which you can put a character in to display for each plot.  See this:

http://blogs.sas.com/content/graphicallyspeaking/?s=symbol%3D

 

Note that blog is very useful for any graph questions.

DanH_sas
SAS Super FREQ

Here is a sample solution both the GROUPED and OVERLAID cases:

 

Overlaid:

proc sgplot data=sashelp.class;

    symbolchar name=plot1 char='0031'x;

    symbolchar name=plot2 char='0032'x;

    scatter x=age y=height / markerattrs=(symbol=plot1 size=12pt);

    scatter x=age y=height / markerattrs=(symbol=plot2 size=12pt);

run;

 

Grouped (two solutions):

ods graphics / attrpriority=none;

proc sgplot data=sashelp.class;

    symbolchar name=plot1 char='0031'x;

    symbolchar name=plot2 char='0032'x;

    styleattrs datasymbols=(plot1 plot2);

    scatter x=age y=height / group=sex markerattrs=(size=12pt);

run;

 

- OR -

 

data attrmap;

retain id "gender";

input value $ markersymbol $;

cards;

F plot1

M plot2

;

run;

 

proc sgplot data=sashelp.class dattrmap=attrmap;

    symbolchar name=plot1 char='0031'x;

    symbolchar name=plot2 char='0032'x;

    scatter x=age y=height / group=sex markerattrs=(size=12pt) attrid=gender;

run;

 

 

 

 

vishnumethas
Calcite | Level 5
  1. Produce a simple scatter plot 2. Label the axes 3. Label the data points 4. Group the data points using colors and symbols SESUG 2011 2 5. Use the %MODSTYLE macro to set non-default colors and symbols 6. Maintain the same colors and symbols across plots 7. Add a 45-degree line 8. Change the color of the 45-degree line 9. Label the legend for the colors and symbols 10. Position the legend 11. Adjust the height and width of the plot 12. Specify the output location.

 

vishnumethas
Calcite | Level 5
  1. Produce a simple scatter plot 2. Label the axes 3. Label the data points 4. Group the data points using colors and symbols SESUG 2011 2 5. Use the %MODSTYLE macro to set non-default colors and symbols 6. Maintain the same colors and symbols across plots 7. Add a 45-degree line 8. Change the color of the 45-degree line 9. Label the legend for the colors and symbols 10. Position the legend 11. Adjust the height and width of the plot 12. Specify the output location

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 3424 views
  • 0 likes
  • 4 in conversation