• Print  |
  • Feedback  |

FOCUS AREAS

Return to SAS 9

Base SAS

Enhancements to ODS PDF for SAS 9.2


Introduction

This topic demonstrates some of the new features in the ODS PDF destination for SAS 9.2.


Text Decoration

You can now specify text decorations (underline, overline, and line-through) in PDF. Here is a quick example showing this new functionality:

  options nonumber nodate;
  ods pdf file="line.pdf" notoc;
  ods escapechar='^';
  title underlin=1 "Here is an underlined title using underlin=.";
  title2 "^{style [textdecoration=line_through]Here is a title with a line through it.}";
  title3 "^{style [textdecoration=overline]Here is an overlined title.}";
  title4 "^{style [textdecoration=underline]Here is another title that switches from underline to}
         ^{style [textdecoration=line_through]line-through and then}
         ^{style [textdecoration=overline]overline}.";

  proc print data=sashelp.class(obs=1);run;

  ods pdf text="^{style [just=r textdecoration=underline color=red]Here is some
      random underlined text.}";

  ods _all_ close;
  ods listing;


Security

Is SAS 9.2, you can easily encrypt and password-protect your PDF output files. Two levels of security are available: 40-bit (low) and 128-bit (high). With either of these settings, any PDFs generated from ODS require a password to open. To enable encryption and password protection, simply use the OPTIONS statement as follows:

  /* Low security with password 'testpw' */
  options pdfsecurity=low pdfpw=(open=testpw);

  /* High security with password 'testpw' */
  options pdfsecurity=high pdfpw=(open=testpw);

Here is the option code together with the ODS PDF statement:

  options pdfsecurity=high pdfpw=(open=testpw);
  ods pdf file="secure.pdf";
  proc contents data=sashelp.class; run;
  ods pdf close;


Table of Contents Expansion

By default, the PDF table of contents is fully expanded when you open the file. This can be irritating if you have a huge table of contents. You may have to collapse several folders just to find some sections of a report. The PDFTOC= option of the ODS PDF statement solves this problem by enabling you to set a lower level of expansion for the table of contents. For example, the following line causes the table of contents to be expanded at the second level:

  ods pdf file="test.pdf" pdftoc=2;

Here is a sample job complete with data:

  title1 'Three-Way Anova with Contrasts';

  * From Cochran and Cox (1957), p. 176.;

  data one;
     do rep=1 to 2;
        do time=1 to 4;
           do current=1 to 4;
              do number=1 to 3;
                 input y @@;
                 output;
              end;
           end;
        end;
     end;
  cards;
  72 74 69 61 61 65 62 65 70 85 76 61
  67 52 62 60 55 59 64 65 64 67 72 60
  57 66 72 72 43 43 63 66 72 56 75 92
  57 56 78 60 63 58 61 79 68 73 86 71
  46 74 58 60 64 52 71 64 71 53 65 66
  44 58 54 57 55 51 62 61 79 60 78 82
  53 50 61 56 57 56 56 56 71 56 58 69
  46 55 64 56 55 57 64 66 62 59 58 88
  ;
  run;

  ods pdf file="pdftoc.pdf" pdftoc=2;

  proc glm;
     class rep current time number;
     model y=rep current|time|number;
     contrast 'Time in Current 3'
        time 1 0 0 -1 current*time 0 0 0 0 0 0 0 0 1 0 0 -1,
        time 0 1 0 -1 current*time 0 0 0 0 0 0 0 0 0 1 0 -1,
        time 0 0 1 -1 current*time 0 0 0 0 0 0 0 0 0 0 1 -1;
     contrast 'curr 1 vs. curr 2' current 1 -1;
  run;

  ods pdf close;

  title;