BookmarkSubscribeRSS Feed
jswinford
Obsidian | Level 7

I am having problems changing colors on my graphs.  I haven't done a lot of work with graphic so bear with me.

 

This is my code:
proc sgplot data=work.s_av;

where VIMS_SPECIES_CODE=597;
series x=YEAR y=N_OBS;
refline 0 / axis=y lineattrs=(color=black);
title 'Trawl Shrimp Landings and Average Minimum Winter Temperatures'; run;

I'm not sure if it has anything to do with SAS's preset colors, but I am a little confused on all of that anyway.  I've also tried using the RBG code instead of using the color words.

 

7 REPLIES 7
ballardw
Super User

You question isn't very clear. Which color are you attempting to change? You have lines, markers, text, borders, backgrounds, marker outlines as a minimum that you can provide colors for.

 

Can you show the code that didn't "work" with other colors that you tried and what was not as desired for the output?

jswinford
Obsidian | Level 7

The code I gave was the code that didn't work.  Attempting to change line color from blue to black.  No matter what I do it just stays blue (or does the default colors, as I've found out).  

ballardw
Super User

Which line? The line you have set to black is the REFLINE not the SERIES.

Reeza
Super User

You can specify colours using the hex code with a CX in front, 

 

color=cxffffff;

jswinford
Obsidian | Level 7

I've already tried those codes and it still doesn't work.

Reeza
Super User

@jswinford What colour are you trying to change? 

What version of SAS do you have? 

 

 

You can specify colour detail quite easily in SAS 9.4+

http://support.sas.com/documentation/cdl/en/grstatproc/69716/HTML/default/viewer.htm#n18szqcwir8q2nn...

ballardw
Super User

@jswinford wrote:

I've already tried those codes and it still doesn't work.


I suspect that you had a syntax problem. So show the actual code.

 

Doesn't work is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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