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.

 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 624 views
  • 0 likes
  • 2 in conversation