Search code examples
sassas-ods

ODS PDF - Two columns of output interrupted by one column of output on a single page


I'm trying to create an output for a requestor that wants me to take a preexisting report that comes in two columns on a single page and break it apart on that single page into different subsections, which they want indicated by a new title in the middle of the page where the new subsection begins.

What I have right now is:

ods pdf file=_pdf_ newfile=none startpage=no columns=2 notoc contents=no
style=swsp;

ods text = 'EMPLOYER RENEWAL DATA';

proc report data=renewal_data;
 ...
run;

ods startpage=now;
ods text='FINANCIAL DATA (FULL PROGRAM YEAR)';
proc report data=financial_data_total;
  ...
run;

ods startpage=now;
title1 '$ACA_YR_STR. ACADEMIC YEAR DATA';
footnote;

ods text='APPLICANT DATA';
 ...
run;

What I want is the page to have a section title where the second ods startpage=now is located that treats the entire page as one column, but then returns to two columns for the remainder of the page.

Thanks!


Solution

  • If you have SAS 9.4 (and possibly 9.3), you can use ODS LAYOUT to achieve this pretty easily. You need to create a gridded layout, and then change your title to another ODS TEXT (which you can of course style to be like a title). Titles go with PROCs, not by themselves, so if you actually use title it will appear where the next PROC REPORT goes, not in its own area.

    Here's a barebones example that might get you started. See the ODS REGION and ODS LAYOUT documentation for more information. Note, this is something that is in production, but is also in active development, so different versions of SAS (including newer ones) may change how some of this works (though hopefully not break formerly existing functionality, who knows).

    ods pdf file="c:\temp\test.pdf" startpage=no newfile=none notoc contents=no
    style=swsp;
    options obs=10;
    
    ods layout gridded columns=2 rows=3;
    ods region row=1 column=1;
    ods text = 'CLASS DATA';
    
    proc report data=sashelp.class;
     columns name age;
    run;
    
    ods region row=1 column=2;
    ods text='CAR DATA';
    proc report data=sashelp.cars;
      columns make model;
    run;
    
    ods region column_span=2 row=2 column=1;
    ods text='ACROSS THE WHOLE PAGE NOW';
    footnote;
    
    ods region row=3 column=1;
    ods text='NOT ACROSS WHOLE PAGE FOR THIS PART';
    proc report data=sashelp.baseball;
      columns name team;
    run;
    ods layout end;
    ods pdf close;