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
- /
- PROC SGPANEL: SERIES statement has no Y2AXIS optio...

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

2 weeks ago

I have created some very nice plots using PROC SGPLOT, using the several SERIES statements, some of which use the Y2AXIS option, to generate line plots with 2 different vertical axes. Great, exactly what I wanted.

Then, I wanted 4 of these plots on a page (2 rows and 2 columns), so I switch to PROC SGPANEL which will produce this 2x2 matrix of plots, but then I discover there is no Y2AXIS option on the SERIES statement.

So, my question ... can someone recommend a workaround or alternative that can give me two different vertical axis scales in PROC SGPANEL?

I know I can do this in traditional SAS/GRAPH with templates in PROC GREPLAY, but since my code is already written in ODS GRAPHICS, I'd prefer to stay in ODS Graphics if possible.

Accepted Solutions

Solution

2 weeks ago

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

2 weeks ago - last edited 2 weeks ago

Hi Paige,

Depending on your ODS destination, you might be able to use ODS LAYOUT GRIDDED on the original SGPLOT output. This statement was added in SAS 9.4m1. Some simple examples are:

- Chris's blog: Using the ODS statement to add layers in your ODS sandwich
- My blog: Arrange matrices and graphs in a gridded layout

Run the following simple example to get an idea how it works, then let us know whether this might suit your needs:

```
ods graphics / width=4in height=2in;
ods layout gridded columns=2 advance=table;
proc sgplot data=sashelp.stocks;
where stock="IBM";
series x=date y=open;
series x=date y=volume / y2axis;
run;
proc sgplot data=sashelp.stocks;
where stock="Intel";
series x=date y=open;
series x=date y=volume / y2axis;
run;
proc sgplot data=sashelp.stocks;
where stock="Microsoft";
series x=date y=open;
series x=date y=volume / y2axis;
run;
proc sgplot data=sashelp.stocks;
vbox open / category=stock;
run;
ods layout end;
```

All Replies

Solution

2 weeks ago

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

2 weeks ago - last edited 2 weeks ago

Hi Paige,

Depending on your ODS destination, you might be able to use ODS LAYOUT GRIDDED on the original SGPLOT output. This statement was added in SAS 9.4m1. Some simple examples are:

- Chris's blog: Using the ODS statement to add layers in your ODS sandwich
- My blog: Arrange matrices and graphs in a gridded layout

Run the following simple example to get an idea how it works, then let us know whether this might suit your needs:

```
ods graphics / width=4in height=2in;
ods layout gridded columns=2 advance=table;
proc sgplot data=sashelp.stocks;
where stock="IBM";
series x=date y=open;
series x=date y=volume / y2axis;
run;
proc sgplot data=sashelp.stocks;
where stock="Intel";
series x=date y=open;
series x=date y=volume / y2axis;
run;
proc sgplot data=sashelp.stocks;
where stock="Microsoft";
series x=date y=open;
series x=date y=volume / y2axis;
run;
proc sgplot data=sashelp.stocks;
vbox open / category=stock;
run;
ods layout end;
```

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

2 weeks ago

Thanks, @Rick_SAS, this looks exactly like what I want to do. Ideally, the output is via ODS POWERPOINT. I'll take a crack at it and see if I can get it to work.

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

2 weeks ago

Well that was easy! Chris's example works fine with ODS POWERPOINT.

Thanks @Rick_SAS and @ChrisHemedinger.

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

2 weeks ago

Now I have found that I can produce one such 2x2 matrix of plots using SGPLOT and have it show up in Powerpoint via ODS POWERPOINT. Works great.

But I actually want seven different 2x2 matrices of plots, one on each page of a POWERPOINT document, and SAS crashes when I try this via a macro %DO loop to loop over all seven variables of interest.

If I re-write the same loop to create seven different Powerpoint files, with one plot each, no errors and no crashes.

Performing both of the above attempts to output the plots via ODS HTML, no error and no crashes either way.

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

2 weeks ago

The below "unmacroized" SAS code produces expected output with 9.4M4. Sorry, the discussion software won't allow me to attach crash.pptx.

-- David Kelley

Output Delivery and Reporting

SAS

ods graphics / width=4in height=2in;

ods powerpoint file = "crash.pptx";

ods layout gridded columns=2 advance=table;

proc sgplot data=sashelp.stocks;

where stock="IBM";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Intel";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Microsoft";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

vbox open / category=stock;

run;

ods layout end;

ods powerpoint startpage=now;

ods layout gridded columns=2 advance=table;

proc sgplot data=sashelp.stocks;

where stock="IBM";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Intel";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Microsoft";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

vbox open / category=stock;

run;

ods layout end;

ods powerpoint startpage=now;

ods layout gridded columns=2 advance=table;

proc sgplot data=sashelp.stocks;

where stock="IBM";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Intel";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Microsoft";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

vbox open / category=stock;

run;

ods layout end;

ods powerpoint startpage=now;

ods layout gridded columns=2 advance=table;

where stock="IBM";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Intel";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Microsoft";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

vbox open / category=stock;

run;

ods layout end;

ods powerpoint startpage=now;

ods layout gridded columns=2 advance=table;

where stock="IBM";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Intel";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Microsoft";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

vbox open / category=stock;

run;

ods layout end;

ods powerpoint startpage=now;

ods layout gridded columns=2 advance=table;

where stock="IBM";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Intel";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Microsoft";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

vbox open / category=stock;

run;

ods layout end;

ods powerpoint startpage=now;

ods layout gridded columns=2 advance=table;

where stock="IBM";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Intel";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

where stock="Microsoft";

series x=date y=open;

series x=date y=volume / y2axis;

run;

proc sgplot data=sashelp.stocks;

vbox open / category=stock;

run;

ods layout end;

ods powerpoint close;

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

2 weeks ago - last edited 2 weeks ago

ods powerpoint startpage=now;

I think that's what I might have been missing.

Of course, my company is still using 9.4M2, so maybe that's the problem.

I will try these out tomorrow at work.

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

2 weeks ago

It appears that the STARTPAGE option of the ODS POWERPOINT command does not exist in my version SAS 9.4 TS1M2