BookmarkSubscribeRSS Feed
Mikeyjh
Calcite | Level 5

In 9.1.3 is there an proc report option to control the page formatting in PDF so that a new page isnt thrown that splits a set of records across 2 pages?

So for example if I have a dataset with 50 columns and 20 rows:

-     currently the output is split across 2 pages such that all 20 rows and columns 1-25 are on page one, and, all 20 rows and columns 26-50 are on the second page.

-     I would like to see two pages but with rows 1-10 and all columns on the first page (maybe split across 2 tables) and rows 11- 20 rows and all columns on the second page. (So the rows are present on a single page.)

I hope that make sense.

3 REPLIES 3
ballardw
Super User

You may need to change how you are currently creating your output. Since you don't mention how you are generating output, Proc Print, Proc Report, Proc Tabulate, ODS FILE Print or statistical procedure it is hard to recommend ideas as each one has options that might work.


Mikeyjh
Calcite | Level 5

Hi ballardw. I did mention proc report in my question and that is what I'm using to create the PDF output. Looking around the forum here I see that there may not be an answer to my question but any guidance would be great.

Thanks.

ballardw
Super User

The closest I can come requires that the data be preprocessed. The following code does what I think you are looking for. However if your variable names or lengths of output are any longer than I'm showing then you will get another block of variables. I find that I don't like FILE PRINT ODS as you don't have much control, hence the keep variables and the order in the data set is the output order. The ODS Style is controlling fontsize. If a style with a larger font is used then the lines are longer and PDF will break the columns yet again.

My example has an ID variable so you can connect the separate lines of the same observation.

data junk;
   do id = 1 to 20;
      Array x x1-x48;

      do j=1 to dim(x);
         x= ranuni(237);
      end;
      output;
   end;
   drop j;
   format x1-x50 f5.4;
run;  
ods pdf file="d:\data\part1.pdf" style=meadow startpage=no;
data _null_;
   set junk (obs=10 keep=id x1-x24);
   file print ods;
   put  id x1-x24;
run;
data _null_;
   set junk (obs=10 keep=id x25-x48);
   file print ods;
   put  id x25-x48 ;
run;
ods pdf startpage=now;
data _null_;
   set junk (firstobs=11 obs=20 keep=id x1-x24);
   file print ods;
   put  id x1-x24;
run;
data _null_;
   set junk (firstobs=11 obs=20keep=id x25-x48);
   file print ods;
   put  id x25-x48 ;
run;
ods pdf close;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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