Desktop productivity for business analysts and programmers

SGPLOT: color of multiple lines

Reply
Frequent Contributor
Posts: 89

SGPLOT: color of multiple lines

Hi. I'm running a multiple line plot with SGPLOT and I get 12 lines of basically the same color. All kinds of beiges or blues. Any way to make it have more vibrant colors?  Here's my code and styleattrs does not work for me.

proc sort data=dataname;
by Month hour;
run;

proc means data=dataname noprint;
by Month hour;
var Load temp dew win cc;
output out=Meanz mean=;
run;

proc print data=Meanz;
run;

proc sgplot data=Meanz;
series x=Hour y=Load / group=Month lineattrs=(thickness=2 pattern=solid);
xaxis values=(0 to 23 by 1);
run;
Respected Advisor
Posts: 3,277

Re: SGPLOT: color of multiple lines

Something like this:

 

proc sgplot data=Meanz;
styleattrs datacontrastcolors=(red green blue cyan orange);
series x=Hour y=Load / group=Month lineattrs=(thickness=2 pattern=solid);
xaxis values=(0 to 23 by 1);
run;
--
Paige Miller
Frequent Contributor
Posts: 89

Re: SGPLOT: color of multiple lines

Posted in reply to PaigeMiller
styleattrs does not work on my version of SAS. Any way around it ?
Respected Advisor
Posts: 3,277

Re: SGPLOT: color of multiple lines

[ Edited ]

What version of SAS is that?


What is the ERROR message? Show us the relevant parts of the SASLOG.

--
Paige Miller
Frequent Contributor
Posts: 89

Re: SGPLOT: color of multiple lines

Posted in reply to PaigeMiller
I'm using SAS EG 4.3 at the moment.

This is the error:
112 styleattrs datacontrastcolors=(red green blue cyan orange);
__________
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
Respected Advisor
Posts: 3,277

Re: SGPLOT: color of multiple lines

Please show us the relevant parts of the SASLOG. This would be the SASLOG for the entire PROC SGPLOT code from start to end of PROC SGPLOT, including warnings and errors.

--
Paige Miller
Super User
Posts: 24,010

Re: SGPLOT: color of multiple lines

proc product_status;

run;

 

This will give you the SAS version. That’s a really, really old EG version as well. I think current one is 7.3

Super User
Posts: 24,010

Re: SGPLOT: color of multiple lines

Did the DataAttr map not work? If not, trying changing your overall style. Not sure what your destination is, but if it was PDF it would be like:

 

ods pdf file='path to file.pdf' <other options> style=seaside;

@matt23 wrote:
styleattrs does not work on my version of SAS. Any way around it ?

 

Frequent Contributor
Posts: 89

Re: SGPLOT: color of multiple lines

I'll just use gplot in this case. But can you help me make these lines thicker and delete the symbols?

 

symbol1 i = j value = W font = marker c = vivb h = 1 line = 1 width = 1;
symbol2 i = j value = W font = marker c = bigb h = 1 line = 1 width = 1; 
symbol3 i = j value = W font = marker c = liolbr h = 1 line = 1 width = 1;
symbol4 i = j value = W font = marker c = lilg h = 1 line = 1 width = 1; 
Respected Advisor
Posts: 3,277

Re: SGPLOT: color of multiple lines


@matt23 wrote:

I'll just use gplot in this case. But can you help me make these lines thicker and delete the symbols?

 

symbol1 i = j value = W font = marker c = vivb h = 1 line = 1 width = 1;
symbol2 i = j value = W font = marker c = bigb h = 1 line = 1 width = 1; 
symbol3 i = j value = W font = marker c = liolbr h = 1 line = 1 width = 1;
symbol4 i = j value = W font = marker c = lilg h = 1 line = 1 width = 1; 

It seems relatively obvious how to make the lines thicker and delete the symbols. You ought to be able to figure this out yourself.

--
Paige Miller
Super User
Posts: 10,850

Re: SGPLOT: color of multiple lines

[ Edited ]

data meanz;
set sashelp.air;
group=year(date);
run;
proc sgplot data=Meanz NOCYCLEATTRS;
series x=date y=air / group=group lineattrs=(thickness=2 pattern=solid);
run;

 

 

OR try:

 

ods graphics/ ATTRPRIORITY=color;

proc sgplot ............

Super User
Posts: 24,010

Re: SGPLOT: color of multiple lines

@Ksharp I think he's on SAS 9.2 which doesn't have a lot of the SGplot features.

Ask a Question
Discussion stats
  • 11 replies
  • 130 views
  • 1 like
  • 4 in conversation