BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
TashaChapWUSS
Obsidian | Level 7

Hey guys!

So, I was using PROC PRINT in SAS EG (output using the default Excel report output options), and I noticed that it was printing each BY Variable on a separate tab, which is *not* what I want it to do (waaaaaaaay too many tabs).  I thought it required a PAGEBY statement for this kind of behavior?  

 

Anyway, is there any way that I can have my report sectioned out by my BY Variable, but have the entire report appear on one tab?

 

FYI, I also tried this with an explicit ODS Excel statement to see if that made a difference, just in case there was a weird option hiding in the SAS EG default that I wasn't aware of and it came out the same.

 

Here's the PROC PRINT code.  As you can see, it's pretty simple.

 

proc print data=dataerrorname noobs;
by tk_ois_establish;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Look at the SHEET_INTERVAL option that allows you to specify when a new sheet is started. Assuming you're using ODS EXCEL.

View solution in original post

4 REPLIES 4
TashaChapWUSS
Obsidian | Level 7
Just a couple minor things that I forgot to mention.

The data is sorted by tk_OIS_establish and one other variable to the right.

I had read that NOBYLINE causes this kind of behavior (separate page per BY group), and although I had not specified that option, I tried an OPTIONS BYLINE statement just to be sure, but that made no difference either.
Reeza
Super User
Look at the SHEET_INTERVAL option that allows you to specify when a new sheet is started. Assuming you're using ODS EXCEL.

TashaChapWUSS
Obsidian | Level 7

Whew, that worked.  I set the SHEET_INTERVAL="NONE" in the ODS Excel statement, and that did it.  Must have had a different default than I realized.  Thanks!

ballardw
Super User

@TashaChapWUSS wrote:

Whew, that worked.  I set the SHEET_INTERVAL="NONE" in the ODS Excel statement, and that did it.  Must have had a different default than I realized.  Thanks!


The default for Sheet_interval is "table". Since each of your by values creates a different table, at least as far as ODS output is concerned, each went to a separate sheet.

 

You would see different behavior if you ran Proc Univariate or some other procedure with multiple tables.

Then the BYGROUP option keeps all the tables of a single by value on a sheet.

Another option value to consider would be PROC to keep each procedure output on a single tab.

 

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 2161 views
  • 2 likes
  • 3 in conversation