Data visualization with SAS programming

Changing colors in sgscatter

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 78
Accepted Solution

Changing colors in sgscatter

Hi,

 

I am using sgscatter:

 

PROC SGSCATTER DATA=test;
TITLE "Matriz del trazado de dispersión";
MATRIX compras_3m compras_12m tipo_cliente1 rango_edad
/ GROUP=res_campa ;
RUN;

 

I get some graph x-y combining compras_3m compras_12m tipo_cliente1 rango_edad and the color and symbol of the dot

is res_campa. The var res_campa is my target var in the model. It has 2 possible values 1 and 0.

I want to change the color and the symbol of res_campa values in my graph of sgscatter, how can I do it??

The default color are very similar and the graph is using by defalut the same symbol (o) for both values.

 

I want ti change color and symbol of dots depending on res_campa values.

 

If the solution is using sgplot or similar I don't mind to use another proc...

 

Any advice will be greatfull appreciatted.

 

Thanks in advance.

 

Juan

 

 

 


Accepted Solutions
Solution
‎08-01-2016 05:18 AM
Esteemed Advisor
Esteemed Advisor
Posts: 6,726

Re: Changing colors in sgscatter

Hi,

 

First port of call on any graph related question:

http://blogs.sas.com/content/graphicallyspeaking/

 

There is examples for virtually every graph imaginable in sgplot/gtl etc.

View solution in original post


All Replies
Solution
‎08-01-2016 05:18 AM
Esteemed Advisor
Esteemed Advisor
Posts: 6,726

Re: Changing colors in sgscatter

Hi,

 

First port of call on any graph related question:

http://blogs.sas.com/content/graphicallyspeaking/

 

There is examples for virtually every graph imaginable in sgplot/gtl etc.

Frequent Contributor
Posts: 78

Re: Changing colors in sgscatter

Thanks, this is my solution:

 

data Attrs;
length Value 8. MarkerColor $20 Markersymbol $20;
ID = "res_campa";
Value = 0; MarkerColor = "DarkBlue "; Markersymbol = "circlefilled "; output;
Value = 1; MarkerColor = "DarkRed "; Markersymbol = "star ";output;
run;

 

PROC SGSCATTER DATA=test DATTRMAP=Attrs;
TITLE "Matriz del trazado de dispersión";
MATRIX compras_3m compras_12m tipo_cliente1 rango_edad
/
GROUP=res_campa ATTRID=res_campa ;

RUN;

Post a Question
Discussion Stats
  • 2 replies
  • 220 views
  • 2 likes
  • 2 in conversation