BookmarkSubscribeRSS Feed
DavidPhillips2
Rhodochrosite | Level 12

Does SG scatter have the ability to show multiple lines on one graph.  E.g.

proc sgscatter  data=temp;

plot (weight height)*age / join;

run;

Displays a graph with weight and age and a graph with height and age.

proc sgscatter  data=temp;

plot ((weight of molly john matt sam) (height of molly sam matt)*age / join;

run;

I’m trying to obtain the group functionality of sgplot but the shared legend of sgscatter.

7 REPLIES 7
DanH_sas
SAS Super FREQ

You can use a GROUP to do this:

proc sgscatter  data=temp;

plot (weight height)*age / join group=sex;

run;

DavidPhillips2
Rhodochrosite | Level 12

Does sgscatter have a stat feature like the stat feature of sgplot where you can compare roll the data up by summation e.g.

stat=sum

DanH_sas
SAS Super FREQ

No, you need to use PROC MEANS or PROC SUMMARY to do the data summarization before you plot it.

DavidPhillips2
Rhodochrosite | Level 12

By using a summary method I was able to see my data in groups of lines.

Does sgscatter have a panel by feature like sgpanel?

  1. E.g. if car is blue show in panel one, if car is red show in panel two

I’m researching the join and compare features and these seem to be designed to show different variables on each graph rather than a split of a group.

DanH_sas
SAS Super FREQ

If you want a graph of that form, is is best to use SGPANEL:

proc sgpanel data=raw_data;

panelby color;

vline c / response= r group=g stat=sum markers;

run;

-- or --

proc sgpanel data=sum_data;

panelby color;

series x=x y=y / group=g markers;

run;

DavidPhillips2
Rhodochrosite | Level 12

The problem with using sgpanel is that I need to resize the series scale.  I looked at the option of using uniscale=row layout=columnlattice.  However  I need to conserve space.  Sgpannel is great for placing two line graphs side by side if they have the same scale. It can nicely place them one one top of the other with different scales.  If you place the graphs side by side ( which  I need to do ) and use sgpanel the line goes vertical in a way in which the reader will have extreme difficultly reading the graph.  I found sgpanel useful for side by side barcharts with different scales.

Which is why I am looking into ways to use sgscatter. The ideal output would be

Line Graph 1 with series 1 line graph 2 with series 2.

DavidPhillips2
Rhodochrosite | Level 12

I ended up hard coding a separate legend for this beside my graphs.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 1360 views
  • 1 like
  • 2 in conversation