BookmarkSubscribeRSS Feed
Obsidian | Level 7

Good day,


I need to color the graphs drawn according to the customer requirements. The customer only need yellow, green, red and orange for each point in the data set.

The program below only provides colors set by SAS. Can you help modify the program to assist the customer or is there any other way I could follow to assist the customer?

%let date1=%sysfunc(today(),date9.);
%Let reports = <library>;
ods _all_ close;
ODS excel FILE = "&reports\Metsi_Charts &date1..xlsx";
ods graphics on / width=27.94cm height=15.24cm noscale;
ods excel options(autofilter="1-6" sheet_name = "Determinand " embedded_titles='yes');
proc sgplot data=datasets.Metsi2 ;
  vline dates / response=value group=point groupdisplay=cluster ;
 yaxis values=(0 to 2.4 by 0.2) label='Determinand' grid LABELATTRS=(weight=bold family=Helvetica size=7 )
    VALUEATTRS=(family=Helvetica size=7 style=normal weight=normal ) ;
refline 0.1 / axis=y label=('0.1 mg/L') lineattrs=(color=red pattern=dash) labelattrs=(size=7) labelloc=inside;
xaxis interval=day VALUESROTATE=VERTICALlabel='Sampled dates' LABELATTRS=(weight=bold size=7) valuesrotate=vertical   
VALUEATTRS=(family=arial size=10 style=normal weight=normal ) type=time;
title1 j=c "Metsi Determinand trend" bold;



Diamond | Level 26

Are you talking about using these colors in VLINE or somewhere else? Explain further. Please be specific.



Paige Miller
Obsidian | Level 7
Yes. I think the vline step could be the appropriate step to include these colors for each point. Thanks
Diamond | Level 26

So, explain further. Do you want specific colors for specific VLINEs? I don't understand how the colors are used.

Paige Miller
Obsidian | Level 7
Good day

Each vline corresponding to a point should have its own color. When I run this SAS code it gives each vline a color that I did not select. So I want to assign each vline a specific color of my choice.
Meteorite | Level 14

Use attribute maps:

here is the doc. with examples:

here is a tutorial by Joshua Horstman:


Polish SAS Users Group: and

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 3 in conversation