BookmarkSubscribeRSS Feed
mmohotsi
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";
OPTIONS PAGESIZE=MAX ORIENTATION=LANDSCAPE;
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;
title;
run;

 

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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

 

 

--
Paige Miller
mmohotsi
Obsidian | Level 7
Yes. I think the vline step could be the appropriate step to include these colors for each point. Thanks
PaigeMiller
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
mmohotsi
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.
yabwon
Onyx | Level 15

Use attribute maps:

here is the doc. with examples: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/n06cil5e9uw87mn1n7pzfefidh04.htm

here is a tutorial by Joshua Horstman: https://www.youtube.com/watch?v=Wm8VkqDjBps

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"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



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