BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hadrien
Obsidian | Level 7

I have a table with the following fields:

HappinessIncomeHappy
455000Yes
790000Yes
-3120000No
842000Yes
-617000No

 

I am trying to create a scatter plot of the results where all Happy="Yes" points show up as blue and all Happy="Red" points show up as red. Unfortunately, my code produces the inverse (happy folks show up as red). How do I specify that SYMBOL1 should be applied to Happy="No" values and SYMBOL2 to Happy="Yes"?

 

 

/*Graph results*/
TITLE 'Happiness vs. Income';
SYMBOL1 VALUE=dot HEIGHT=0.3 CO=RED;
SYMBOL2 VALUE=dot HEIGHT=0.3 CO=STEEL;
PROC GPLOT DATA=PL_H3_DRC_POLS;
	PLOT Happiness*Income=Happy ;
RUN;

 

Thanks in advance for the help

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi Hadrien,

 

I think it will work if you just write COLOR= instead of CO= in your SYMBOL statements. (At least it worked in my SAS session.) CO= is not an alias for COLOR=, but "specifies color for confidence limit lines and area outlines" (documentation).

View solution in original post

3 REPLIES 3
ballardw
Super User

In GPLOT you do not have this functionality. The Assignments of symbol to value are generally the first VALUE for the variable found is assigned the first Symbol, second to second, etc.

So sort your data by HAPPY so that the value you want to be red is the first value.

 

Or move over to SGPLOT. With SAS 9.3 they added a feature to assign attributes to values for consistency.

FreelanceReinh
Jade | Level 19

Hi Hadrien,

 

I think it will work if you just write COLOR= instead of CO= in your SYMBOL statements. (At least it worked in my SAS session.) CO= is not an alias for COLOR=, but "specifies color for confidence limit lines and area outlines" (documentation).

Hadrien
Obsidian | Level 7

Thanks for the help, I was confused about what CO did. I got it to work using COLOR and changing the order of the SYMBOL variables.

sas-innovate-white.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.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1409 views
  • 0 likes
  • 3 in conversation