Help using Base SAS procedures

How do I specify which values SYMBOL should be applied to in the GPLOT procedure?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

How do I specify which values SYMBOL should be applied to in the GPLOT procedure?

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

 


Accepted Solutions
Solution
‎06-06-2016 09:24 AM
Trusted Advisor
Posts: 1,117

Re: How do I specify which values SYMBOL should be applied to in the GPLOT procedure?

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


All Replies
Super User
Posts: 11,343

Re: How do I specify which values SYMBOL should be applied to in the GPLOT procedure?

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.

Solution
‎06-06-2016 09:24 AM
Trusted Advisor
Posts: 1,117

Re: How do I specify which values SYMBOL should be applied to in the GPLOT procedure?

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).

Occasional Contributor
Posts: 15

Re: How do I specify which values SYMBOL should be applied to in the GPLOT procedure?

Posted in reply to FreelanceReinhard

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 220 views
  • 0 likes
  • 3 in conversation