BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
matt23
Quartz | Level 8

Hi, I'm playing with sgpanel and I'm I need help.zz.png

Can I change colors of individual lines? Also how can I get rid of the connecting lines between first and last point?

 

Here's the code I have:

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

proc means data=ramp noprint;
by Month hour;
var delta Temperature;
output out=Meanf mean=;
run;

proc sgplot data=Meanf;
series x=Hour y=delta / group=Month MARKERS LINEATTRS = (THICKNESS = 2 PATTERN = SOLID);
XAXIS LABEL = 'Hour' GRID VALUES = (0 TO 23 BY 1);
YAXIS LABEL = 'LOAD RAMP(MW)';
title 'Monthly Load Ramp Summary';
run;

proc format library=work;
value season
12,1,2 = 'Winter'
3,4,5 = 'Spring'
6,7,8 = 'Summer'
9,10,11 = 'Fall';
run;

proc sgpanel data=Meanf ;
   panelby month /layout=panel rows=2 columns=2 onepanel ;
   format month season.;
   series x=Hour y=delta / group=Month MARKERS LINEATTRS = (THICKNESS = 2 PATTERN = SOLID) BREAK;
   colaxis label="Temperature (degrees F)";
   rowaxis label="Load Ramp (MW)";
   title 'Load Ramp vs Temperature (overall)';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You might be better off adding a SEASON variable based on your Month. The Format applied to month is honored for grouping in general so you get a single color per season.

 

The connection is caused most likely  by each month having the same "hour". I would try inserting a record at the end of each month with a missing value for hour and delta to create a break in the series.

 

Something like:

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

data ramp1;
   set ramp;
   by month;
   Season= put(month,season.);
   output;
   if last.month then do;
      hour=.;
      delta=.;
      output;
   end;
run;

Use ramp1 with panel by season and don't use the season format in the sgpanel code.

 

View solution in original post

1 REPLY 1
ballardw
Super User

You might be better off adding a SEASON variable based on your Month. The Format applied to month is honored for grouping in general so you get a single color per season.

 

The connection is caused most likely  by each month having the same "hour". I would try inserting a record at the end of each month with a missing value for hour and delta to create a break in the series.

 

Something like:

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

data ramp1;
   set ramp;
   by month;
   Season= put(month,season.);
   output;
   if last.month then do;
      hour=.;
      delta=.;
      output;
   end;
run;

Use ramp1 with panel by season and don't use the season format in the sgpanel code.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 961 views
  • 0 likes
  • 2 in conversation