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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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