How to change the orientation inside an RTF or PDF file


Starting in SAS® 9, the following logic can be used to create an RTF file which toggles orientation inside the file. The same capability is not currently available with the ODS PRINTER destinations (PCL/PDF/PS) until SAS® 9.3.

Before SAS 9.3, if Adobe's Distiller is licensed, the RTF file created by the below ODS RTF code can be converted into a PDF file that has pages with differing orientation.

The Full Code section shows how to change the page orientation inside a PDF file. This syntax is valid in SAS 9.3.

options orientation=landscape;
ods rtf file="file.rtf";

  proc print data=sashelp.class;
  run;

options orientation=portrait;
ods rtf;

  proc print data=sashelp.shoes(obs=100);
  run;

options orientation=landscape;
ods rtf;

  proc print data=sashelp.air(obs=100);
  run;

ods rtf close;

 


Full Code

The following code shows how to change the orientation of pages inside a PDF file. This syntax is valid starting in SAS 9.3. 

options orientation=portrait nodate;                                                                                  
ods pdf file="file.pdf" notoc;                                                                                               
title "&sysver: Orientation=Portrait";                 proc gchart data=sashelp.cars;                         
 vbar cylinders / discrete;                            
 run;                                                  
quit;                                                                                                                             
options orientation=landscape;                                            
title "&sysver: Orientation=Landscape";                 proc gchart data=sashelp.cars;                         
 vbar cylinders / subgroup=origin discrete;            
 run;                                                  
quit;                                                                                          
options orientation=portrait;                                                         
title "&sysver: Orientation=Portrait";                 
proc print data=sashelp.cars noobs;                    
 where cylinders = 4 and origin ne "USA";              
 var origin make model horsepower;                    
run;                                                                                                         
ods pdf close;


Output

9.3 PDF Output