05-08-2015 03:03 PM
Before the PROC GPLOT statement I'm putting symbol statements using the c= or color= option and using blue, green red, etc but no matter what it just gives me black lines. I've created non-black lines on plots plenty of times in the past so I don't know why it won't do it this time. Maybe I have some other options set that is trumping color=. Any ideas are appreciated.
05-08-2015 03:06 PM
Can you post your code? Also, what's your destination - HTML, PDF, RTF or Listing? I'm not sure if listing supports colours.
Does the following code produce a graph with coloured lines?
05-08-2015 03:32 PM
Your code does indeed produce colors for me.
As far as my code goes, it's a macro and before the PROC GPLOT this runs, which was given to me by someone else so I'm not sure what exactly it all does.
goptions reset = global
device = win
rotate = landscape
target = winprtm
cback = white
ctext = black
gsfmode = replace
ftext = swiss
gunit = pct
hby = 0.75
htitle = 2.8
hsize = 9 in
vsize = 6 in
And here is the actual code that makes it plot. I'm pretty sure the mere fact that it's in a macro isn't affecting things and that's why I didn't post the entire macro, along with the fact that it'd be very long if I did that.
|axis1 order = 0 to 1 by 0.10|
|label = (h=3 a=90 r=0 "Probability of Survival")|
width = 3 value = (height = 3) offset = (0,0) minor = (n = 1);
|axis2 order = 0 to 3650 by 500|
|label = (h = 3 "Days Survived") width = 2|
value = (height = 3) offset = (0,0) minor = (n = 1);
symbol1 i=step1j l=1 color=blue ;
symbol2 i=step1j l=1 color=red ;
symbol3 i=step1j l=1 color=green;
|legend1 position=(left inside bottom)|
|label = (H = 3 "&GROUP_LAB" position=(top center))|
value = (height=3 tick=1 "&TICK1" tick=2 "&TICK2" tick=3 "&TICK3");
|proc gplot data=plot;|
|plot surv_k1 * days|
|surv_k2 * days|
|surv_k3 * days / overlay|
|vaxis = axis1|
|haxis = axis2|
|legend = legend1 noframe;|
title1 h=5 "&GRP_NAME Survival";
05-08-2015 04:10 PM
I just did mine again but with ODS HTML first and it opens up in the HTML window and it does indeed have colors. But for whatever reason it is so big you can't see it all at once (and your code gave me a result like that too).
But in the regular SAS Graph window the lines are black. In the past I've been able to put colored lines in there. And I'm not sure I want to use HTML this time anyway, especially since in this particular project I've done a lot of work for the people and their current request is "do the same graph as before but just give us colors now." So even if it is a good idea to use HTML in general I don't want to change horses mid-stream on this project.
That said, I personally just like looking at the regular output window and then perhaps if I finalize what I want outputting it to an RTF or HTML. I think when I use HTML it creates files on my computer for it and I really don't need that when I'm working through the problem but aren't yet to the final results that I might want to send to a client.
05-08-2015 05:27 PM
So now I've tried just using goptions reset=all instead of that other list of options and it does give me colored lines in regular (non-HTML) graph window, but the graph has a bunch of other things weird about it that makes it no good, such as the names of the being so large that it takes up half the graph and the numbers being really big. I guess it comes doing to figuring out what all those options do and which one is preventing the colors from showing up.
05-08-2015 05:53 PM
Yup, guess and test
Turn half of them off at a time and narrow it down.
Also - consider using PROC SGPLOT if you have the option - the graphics out of there are nicer in my opinion.
05-08-2015 03:38 PM
By the way, I'm not using ODS Graphics, although I do use it sometime with other PROCs. I would've assumed that with SAS Graph a graphics thing like ODS Graphics would be always on instead of specified.
05-08-2015 05:59 PM
"Always on" means different things to different folks. The behavior has changed. In SAS 9.3 for instance if you have sgraphics on then every time you run proc freq you get histograms and different graphs for other procedures, which you may not want.
The addition of ODS complicates things with the older SAS Graph procs as well. They will generate a Listing output of the type around since SAS 6, and the specified ODS versions. EACH of those destinations may use a different ODS style to control appearance. To see if the style may be the cause of the only black output try this:
ods listing style=meadow;
ods html style=meadow;
your graphics procedure goes here
ods html close;
ods listing close;
and see if the two different results look more similar