Search code examples
pdfsasods

SAS ODS PDF title page 2


I am somehow failing to get a title to display on the second page of a SAS PDF output. My code (as far as the title statements are concerned) is nearly identical to a previous program I wrote that works perfectly. Page 1 works exactly as intended but page 2 displays no title at all despite my various efforts. Code that I believe should work is below. I took out most of the actual info to make it easier to read, but for some reason if anything inside the proc report or proc sgplot could be affecting the title on the page then let me know and I can share more. Thanks for the help.

    ods pdf file="location/name";
    footnote "footnote";
    ods escapechar='^';
    ods pdf startpage=now;
    options orientation=portrait nodate;
    title1 '^S={Preimage="image"}';
    title2 height=12pt bold 'Page 1 title' ;
    
    
    proc report data= data1 
          /*variables and stuff*/
    run;
    ods pdf startpage =  no;
    
    proc report data= data2 
             /*variables and stuff*/
    run;
    ods pdf startpage=no;
    
    proc report data=data3 
           /*variables and stuff*/
    run;
    ods pdf startpage=no;
    
    proc report data=data4   
             /*variables and stuff*/
    run;
    
    title1;
    title2;
    
    

    *****Page 2;
    
    ods pdf startpage=now;
    options orientation=portrait;
    title3 'Page 2 Title';
    
    proc sgplot data=data5;
        /*variables and stuff*/  
    run;
    
    ods pdf startpage=no;

    proc sgplot data=data6 ;
            /*variables and stuff*/
    run;
    
    title3;
    ods pdf close;

Solution

  • I don't believe it's possible to change the titles that way - titles in PDF are more like PDF-level.

    Looking at this question on SAS Communities, I think the best way to solve this is to use ODS TEXT which lets you put arbitrary text on the page.

    --

    Edit: Reeza has it right; this is very much possible, as long as each page has a new Proc on it. Just make sure NOGTITLE so the grahpics aren't swallowing your titles.