BookmarkSubscribeRSS Feed
mmohotsi
Quartz | Level 8

Good day 

I am trying to create multiple sheets using ods excel in proc sgplot. The code is as follows.

 

%Let Dated = '10Feb2023'd;
%let date1=%sysfunc(today(),date9.);
%Let reports = <path>;
ods _all_ close;
ODS excel FILE = "&reports\Blending &date1 .xlsx";
OPTIONS PAGESIZE=MAX ORIENTATION=LANDSCAPE;
ods graphics on / width=11in height=6in noscale;

ods excel options(autofilter="ALL" sheet_name = "Parameter " embedded_titles='yes');
proc sgplot data=tested (where=(NAME='Parameter' ));
vline dates / response=NUMERIC_ENTRY group=sampling_point groupdisplay=cluster ;
yaxis values=(0 to 200 by 20) label='Parameter' grid LABELATTRS=(weight=bold family=Helvetica size=7)
VALUEATTRS=(family=Helvetica size=7 style=normal weight=normal ) ;

refline &Parameter / axis=y label=('Units') lineattrs=(color=green pattern=dash) labelattrs=(size=7) labelloc=inside;
refline &Dated / axis=x label=('Blending date') lineattrs=(color=red pattern=dash) labelattrs=(size=7) labelloc=inside;
xaxis interval=day VALUESROTATE=VERTICAL
label='Sampled dates' LABELATTRS=(weight=bold size=7) valuesrotate=vertical
VALUEATTRS=(family=arial size=10 style=normal weight=normal )
type=time ;
title1 j=c "Parameter trend" bold;
run;
ods _all_ close;

 

My challenge is that I could only create 8 excel sheets using the above code.

 

Is there a way of getting more sheets on the one workbook? I need close to 70 work sheets on one workbook.

2 REPLIES 2
yabwon
Amethyst | Level 16

Maybe this will help:

proc sort data = sashelp.cars out = cars;
  by Origin;
run;

ods excel file="R:\text.xlsx"
GFOOTNOTE
GTITLE
options(SHEET_INTERVAL='NONE') /* prevent by group sheet break*/
;
options nobyline;

title1 j=c height=1 font="Courier New" 
  "Title Origin: #byval(Origin).."
;
footnote1 j=c height=1 font="Courier New" 
  "Footnote Origin: #byval(Origin).."
;
proc sgplot data=cars;
  by Origin;
  scatter x=Invoice y=MSRP;
run;


ods excel close;

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



PaigeMiller
Diamond | Level 26

I don't see how the code you present will produce more than 1 plot, but you say it works for up to 8 plots, but not more??? How does this code produce 8 plots? What happens when you ask for more than 8 plots, is there an error in the log? If so, please show us the ENTIRE log for this ODS EXCEL.

 

Also, please try it with

 

ods excel options(sheet_interval='PROC');

 

or

 

ods excel options(sheet_interval='PAGE');
--
Paige Miller

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1090 views
  • 0 likes
  • 3 in conversation