The DOCUMENT Procedure

Example 5: Managing Entries

Features:

PROC DOCUMENT statement option: NAME=

DIR statement

LIST statement option: LEVELS=

NOTE statement

OBANOTE statement option: SHOW option

OBBNOTE statement option: SHOW

OBFOOTN statement option: SHOW

OBPAGE statement

OBSTITLE statement option: SHOW

OBTITLE statement option: SHOW

REPLAY statement

Procedure output: PROC CONTENTS

ODS destinations: DOCUMENT

HTML

Details

This example shows you how to do these tasks:
  • generate PROC CONTENTS output to the DOCUMENT destination
  • change the title and footnote of the output
  • add object footer and object heading notes to the output
  • change the subtitle of the output
  • add a note to the document
  • add a page break to the output
  • generate that a table containing the output object’s headings, titles, and footnotes, be written to the active destinations
  • generate a listing of the entries that shows the details for each entry

Program

options nodate pageno=1;
ods document name=class(write);
title 'Title Specified by the Global TITLE Statement';
footnote 'Footnote Specified by the Global FOOTNOTE Statement';
proc contents data=sashelp.class;
run;
ods document close;
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obtitle Attributes#1 'Title Specified by the OBTITLE Statement';
run;
quit;
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obbnote Attributes#1 'Object Heading Note Specified by the OBBNOTE Statement';
run;
quit;
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obfootn Variables#1 'Change the Global Footnote with the OBFOOTN Statement';
run;
quit;
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obanote Attributes#1 'Object Footer Note Specified by the OBANOTE Statement';
run;
quit;
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obstitle Attributes#1 'Subtitle Specified by the OBSTITLE Statement';
run;
quit;
proc document name=class;
   note addnote 'Note added to the document';
 run;
 quit;
ods html file='your_file.html' style=Banker;
proc document name=class;
   obpage \Contents#1\DataSet#1\Variables#1;
   replay;
run;
quit;
proc document name=class;
   list/levels=all details;
   dir \Contents#1\DataSet#1; 
   obanote  Attributes#1  show;
   obbnote  Attributes#1   show;
   obfootn  Variables#1  show;
   obstitle Attributes#1   show;
   obtitle  Attributes#1  show;
run;
quit;
ods html close;  

Program Description

Set the SAS system options. The NODATE option suppresses the display of the date and time in the output. The PAGENO= option specifies the starting page number.
options nodate pageno=1;
Open the DOCUMENT destination. The NAME= option creates an ODS document named Class.
ods document name=class(write);
Specify a global title and footnote. The TITLE statement creates a title that is used until you change it with another statement. The FOOTNOTE statement creates a footnote that is used until you change it with another statement.
title 'Title Specified by the Global TITLE Statement';
footnote 'Footnote Specified by the Global FOOTNOTE Statement';
View the contents of the SAS data set. The CONTENTS procedure shows the contents of the SAS data set Sashelp.Class.
proc contents data=sashelp.class;
run;
Close the DOCUMENT destination and create LISTING output. The entries in the ODS document Class are used in the remainder of this example.
ods document close;
Change the global title. The OBTITLE statement assigns a new title to the Attributes#1 entry. The NAME= option specifies the current ODS document. Note that PROC DOCUMENT is still running after the RUN statement executes. The DIR statement changes the current path to \Contents#1\DataSet#1. The QUIT statement terminates PROC DOCUMENT.
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obtitle Attributes#1 'Title Specified by the OBTITLE Statement';
run;
quit;
Add an object heading note to the output.The OBBNOTE statement assigns an object heading note to the Attributes#1 entry. The NAME= option specifies the current ODS document. The DIR statement changes the current directory to \Contents#1\DataSet#1. The QUIT statement terminates PROC DOCUMENT.
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obbnote Attributes#1 'Object Heading Note Specified by the OBBNOTE Statement';
run;
quit;
Change the global footnote. The OBFOOTN statement assigns a new footnote to the Variables#1 entry. The NAME= option specifies the current ODS document. The DIR statement changes the current directory to \Contents#1\DataSet#1. The QUIT statement terminates PROC DOCUMENT.
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obfootn Variables#1 'Change the Global Footnote with the OBFOOTN Statement';
run;
quit;
Add an object footer note. The OBANOTE statement assigns an object footer note to the Attributes#1 entry. The NAME= option specifies the current ODS document. The DIR statement changes the current directory to \Contents#1\DataSet#1. The QUIT statement terminates PROC DOCUMENT.
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obanote Attributes#1 'Object Footer Note Specified by the OBANOTE Statement';
run;
quit;
Change the subtitle of the output. The OBSTITLE statement changes the subtitle. The subtitle identifies the procedure that produced the output. The NAME= option specifies the current ODS document. The DIR statement changes the current directory to \Contents#1\DataSet#1. The QUIT statement terminates PROC DOCUMENT.
proc document name=class;
   dir \Contents#1\DataSet#1;
run;
   obstitle Attributes#1 'Subtitle Specified by the OBSTITLE Statement';
run;
quit;
Add a note to the document. The NOTE statement adds a note object named ADDNOTE to the ODS document. The NAME= option specifies the current ODS document. The LIST statement with the LEVELS=ALL option shows a list of entries in the Class document. The QUIT statement terminates PROC DOCUMENT.
proc document name=class;
   note addnote 'Note added to the document';
 run;
 quit;
Add a page break to the output, create HTML output, and replay Variables#1. The ODS HTML statement opens the HTML destination and creates HTML 4.0 output. The STYLE= option specifies that ODS use the style Banker. The OBPAGE statement inserts a page break. The NAME= option specifies the current ODS document. The REPLAY statement replays the Variables#1 object and generates output for all open ODS destinations. The QUIT statement terminates PROC DOCUMENT.
ods html file='your_file.html' style=Banker;
proc document name=class;
   obpage \Contents#1\DataSet#1\Variables#1;
   replay;
run;
quit;
Generate a table containing contextual information for each title, footnote, and note.The NAME= option specifies the current ODS document. The LIST statement with the LEVELS=ALL option shows a list of entries in the Class document. The DIR statement changes the current directory to \Contents#1\DataSet#1. The SHOW option generates a table containing contextual information for each title, footnote, and note. The QUIT statement terminates PROC DOCUMENT.
proc document name=class;
   list/levels=all details;
   dir \Contents#1\DataSet#1; 
   obanote  Attributes#1  show;
   obbnote  Attributes#1   show;
   obfootn  Variables#1  show;
   obstitle Attributes#1   show;
   obtitle  Attributes#1  show;
run;
quit;
Close the HTMLdestination. The ODS HTML CLOSE statement closes the HTML destination.
ods html close;  

Output

Global Title, Global Footnote, Subtitle, Object Heading Note, Object Footer Note, and Note
Global Title, Global Footnote, Subtitle, Object Heading Note, Object Footer Note, and Note
Listing of Work.Class
Listing of Work.Class
Context Tables Generated By Specifying the SHOW Option
Context Tables Generated by Specifying the SHOW Option