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

I want one scatter plot with two different groups on it. Each different color. I want weekday and weekend groups.

Weekend when day=0,6, and weekday when day=1,2,3,4,5

Here's what I have so far but I don't know how to divide the days into two groups

 

proc sgplot data=matt;
scatter x=DewPoint y=Load / group by ??????;
xaxis label="Temp";
yaxis label="Load";
run;

 

MonthDayHourLoadTemperature
1107023220.87
1216842220.61
1326701420.27
1436606820.52
1546578121.45
1656630821.69
1066755921.87
1176915022.39
1286978822.72
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

One way, create a new variable :

data want;

   set matt;

   if day in (1:5) then groupvar='Weekday';

   else groupvar='Weekend';

run;

use this data set and the variable groupvar with the group= option.

OR create a custom format for the day variable

 

Proc format;

value myweekday

0,6 = 'Weekend'

1 - 5 = 'Weekday'

;

run;

 

and use group=day and add a separate statement to use the format:

Format day myweekday.;

to the sgplot code.

 

 

 

 

View solution in original post

1 REPLY 1
ballardw
Super User

One way, create a new variable :

data want;

   set matt;

   if day in (1:5) then groupvar='Weekday';

   else groupvar='Weekend';

run;

use this data set and the variable groupvar with the group= option.

OR create a custom format for the day variable

 

Proc format;

value myweekday

0,6 = 'Weekend'

1 - 5 = 'Weekday'

;

run;

 

and use group=day and add a separate statement to use the format:

Format day myweekday.;

to the sgplot 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
  • 1258 views
  • 0 likes
  • 2 in conversation