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
- /
- box plots on same axis

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

a week ago

Hello I am given data such as

state 1985 1996 2002

1 73 45 57

2 82 36 48

3 91 29 35

4 74 10 49

etc.

I can create box plots of 1985, 1996 and 2002 seperately.

I use proc sgplot data = mydata;

vbox 1985;

run;

and I do that for the other years as well, I am attempting to get box plots for all 3 years in the same axis or the same graph.

I have tried proc sgpanel as well as proc box plot with no luck.

I am not sure if I need to perhaps combine the 3 variables into 1 category or group and then do a paneled box plot.

Help would be greatly appreciated.

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

a week ago - last edited a week ago

Transpose your data so you can specify the CATEGORY=YEAR.

Post what your code looks like if you're having issues.

Here's an example that's broader than yours:

http://support.sas.com/rnd/datavisualization/yourGraphs/analyticalQuick/vbox/#s1=1

The SASHELP.CARS data set is available on almost all SAS installations.

Steelz91 wrote:

Hello I am given data such as

state 1985 1996 2002

1 73 45 57

2 82 36 48

3 91 29 35

4 74 10 49

etc.

I can create box plots of 1985, 1996 and 2002 seperately.

I use proc sgplot data = mydata;

vbox 1985;

run;

and I do that for the other years as well, I am attempting to get box plots for all 3 years in the same axis or the same graph.

I have tried proc sgpanel as well as proc box plot with no luck.

I am not sure if I need to perhaps combine the 3 variables into 1 category or group and then do a paneled box plot.

Help would be greatly appreciated.

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

a week ago

Reeza wrote:

Transpose your data so you can specify the CATEGORY=YEAR.

Post what your code looks like if you're having issues.

Here's an example that's broader than yours:

http://support.sas.com/rnd/datavisualization/yourGraphs/analyticalQuick/vbox/#s1=1

The SASHELP.CARS data set is available on almost all SAS installations.

Steelz91 wrote:Hello I am given data such as

state 1985 1996 2002

1 73 45 57

2 82 36 48

3 91 29 35

4 74 10 49

etc.

I can create box plots of 1985, 1996 and 2002 seperately.

I use proc sgplot data = mydata;

vbox 1985;

run;

and I do that for the other years as well, I am attempting to get box plots for all 3 years in the same axis or the same graph.

I have tried proc sgpanel as well as proc box plot with no luck.

I am not sure if I need to perhaps combine the 3 variables into 1 category or group and then do a paneled box plot.

Help would be greatly appreciated.

My current code looks like this

proc import datafile="/folders/myfolders/sasuser.v94/ex3-10.xlsx"

out=mydata dbms=xlsx replace;

run;

title "Box Plot";

proc sgpanel data = mydata;

panelby _1985 _1996 _2002;

vbox year;

*I put year because thats how I think I would get the 3 seperate boxplots but variable is not valid since I cannot get the three columns to be taken as year;

run;

I have also included the dataset that I was given

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

a week ago

Transpose your data so you can specify the CATEGORY=YEAR.

You can use PROC TRANSPOSE to transform your data.

You don't need SGPANEL, unless you want it panelled. I'm unsure if you're looking for a single graph with three boxes or something else now.

Steelz91 wrote:

*I put year because thats how I think I would get the 3 seperate boxplots but variable is not valid since I cannot get the three columns to be taken as year;

I think you're not understanding how the PANELBY is created, but I may also not be understanding what you want. Since this is a graph question, I'll move it to the graph forum. The SAS graph staff is great at answering questions.

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

a week ago

Reeza wrote:Transpose your data so you can specify the CATEGORY=YEAR.

You can use PROC TRANSPOSE to transform your data.

You don't need SGPANEL, unless you want it panelled. I'm unsure if you're looking for a single graph with three boxes or something else now.

Steelz91 wrote:*I put year because thats how I think I would get the 3 seperate boxplots but variable is not valid since I cannot get the three columns to be taken as year;

I think you're not understanding how the PANELBY is created, but I may also not be understanding what you want. Since this is a graph question, I'll move it to the graph forum. The SAS graph staff is great at answering questions.

Okay thank you, yeah I want it all on a single graph. I kept googling how to do it and I kept getting the Panelby syntax popping up so I figured maybe they were using that and combining the graph.

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

a week ago

Check the link I included in my first post. It's probably almost exactly what you want.