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'd like to have all 4 of my scatter plots in one window like this:

Screen Shot 2018-06-22 at 11.08.05 AM.png

I have 4 scatter plots for 4 different seasons. Here's an example of a scatter plot for winter:

proc sgplot data=dataname (where=(Month in(12,1,2)));
scatter x=Temperature y=Load;
xaxis label="Temperature (degrees F)";
yaxis label="Load (MW)";
title 'Load vs Temperature';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The image you show is from SGSCATTER online documentation example 2.

 

Since you want to create a separate graph based on the value of a different variable than is involved in the actual plot then SGPANEL with a custom format for your MONTH variable to get groups probably a good solution. Something like:

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=dataname ;
   panelby month /layout=panel rows=2 columns=2 onepanel ;
   format month season.;
   scatter x=Temperature y=Load;
   colaxis label="Temperature (degrees F)";
   rowaxis label="Load (MW)";
   title 'Load vs Temperature';
run;

may get you started.

 

View solution in original post

3 REPLIES 3
ChrisHemedinger
Community Manager

Check PROC SGPANEL, which allows a PANELBY variable so you can segment your plots.  This works if all X/Y axis variables are the same for each plot, and you're just grouping with another variable.

 

Otherwise, you could use PROC TEMPLATE to design a custom layout.  ODS Graphics Designer is a point-and-click interface that can help you design this with a minimum of manual coding.

ballardw
Super User

The image you show is from SGSCATTER online documentation example 2.

 

Since you want to create a separate graph based on the value of a different variable than is involved in the actual plot then SGPANEL with a custom format for your MONTH variable to get groups probably a good solution. Something like:

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=dataname ;
   panelby month /layout=panel rows=2 columns=2 onepanel ;
   format month season.;
   scatter x=Temperature y=Load;
   colaxis label="Temperature (degrees F)";
   rowaxis label="Load (MW)";
   title 'Load vs Temperature';
run;

may get you started.

 

matt23
Quartz | Level 8

that is amazing, thank you

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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
  • 3 replies
  • 1255 views
  • 4 likes
  • 3 in conversation