turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Scatterplot Help: Graphing A Response Variable Fro...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-21-2016 12:38 PM

Hello,

I need a bit of help creating a graph in SAS University Edition.

What I am trying to do is create a scatterplot where x=response variable, y=time with 4 levels of a grouping variable. Each level of the grouping variable contains 10-12 observations at each time point. I am trying to display all observations across time, but with the observations from each group seperated in space on the chart. (I apologize if this description is lacking).

Here is what I have so far:

```
proc sgplot data=plin2bodycomp_organized;
scatter x=time y=weight / jitter group=Treatment_Group;
run;
/*** weight= Response Variable, Treatment_Group= Group Variable **/
/* Note that jitter does technically separate the values in space, but it is not organized by group */
```

I have also attached the graph it produced:

In R, creating the seperation I am looking for can be dong with the "position dodge" arguments when using the ggplo2 package (example below). Does SAS have anything similar?

Thank you for your time and your help.

Accepted Solutions

Solution

12-21-2016
12:50 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-21-2016 12:46 PM

On your SCATTER plot statement, add GROUPDISPLAY=CLUSTER and see if that works for you.

Thanks!

Dan

All Replies

Solution

12-21-2016
12:50 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-21-2016 12:46 PM

On your SCATTER plot statement, add GROUPDISPLAY=CLUSTER and see if that works for you.

Thanks!

Dan

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-21-2016 12:52 PM - edited 12-21-2016 12:52 PM

Thanks, DanH, that worked!

Is there any way to change the distance between the groups clusters?

Also, in a related note, are there any highly recommended resources for graphing in SAS? I am new to SAS Graphing and would appreciate a solid reference.

Thanks

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-21-2016 01:02 PM

Use the CLUSTERWIDTH option on the SCATTER statement. It is a value between 0 and 1. The default is something like 0.85. In your case, you want to shrink the cluster width, so try a value of 0.4.

As for a graphics reference (shameless plug alert :-)).... If you are working with the SG procedures, Sanjay Matange and I worked on book that should get you up-and-going with the procedures quickly. Check it out and see what you think...

Thanks!

Dan

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-21-2016 01:04 PM

You can also subscribe to "Graphically Speaking" blog for articles on graphing with SAS.

http://blogs.sas.com/content/graphicallyspeaking/

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

12-21-2016 01:39 PM

Thanks again, DanH. This is exactly what I was looking for.

Thanks also for the recommendation, I appreciate it.