BookmarkSubscribeRSS Feed
sfo
Quartz | Level 8 sfo
Quartz | Level 8

Hi,

 

Is there a way I can color code the Y-axis data points used in proc gplot for example:

 

ID YData XData

101 10 10

101 20 20

101 30 30

102 10 40

102 20 50

102 30 60

 

I am using proc gplot YData * XData = ID and would like to color code each YData i.e. value 10 gets color blue, value 20 gets color red, value 30 gets color orange.

 

Also, all the data points for each ID should be connected using a black line.

4 REPLIES 4
DanH_sas
SAS Super FREQ

What version of SAS are you using?

sfo
Quartz | Level 8 sfo
Quartz | Level 8

I am using 9.2 and prefer to use Proc Gplot

 

Thanks

DanH_sas
SAS Super FREQ

See if this will work for you:

 

data test;
input ID YData XData;
cards;
101 10 10
101 20 20
101 30 30
102 10 40
102 20 50
102 30 60
;
run;

symbol1 i=join c=black v=none;
symbol2 i=join c=black v=none;
symbol3 i=none v=dot c=blue;
symbol4 i=none v=dot c=red;
symbol5 i=none v=dot c=orange;
proc gplot data=test;
plot ydata*xdata=id;
plot2 ydata*xdata=ydata;
run;
sfo
Quartz | Level 8 sfo
Quartz | Level 8

Thanks for the solution. It worked.

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
  • 4 replies
  • 1509 views
  • 1 like
  • 2 in conversation