Sample 25355: Basic functionality of the DOCUMENT procedure
The sample code on the Full Code tab is from the SAS® Sample Library and shows the basic functionality of ODS and the DOCUMENT procedure. For additional information, refer to SAS Help and Online Documentation.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample is from the SAS® Sample Library. For additional information, refer to SAS Help and Online Documentation.
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: DOC1 */
/* TITLE: BASIC FUNCTIONALITY OF DOCUMENT */
/* PRODUCT: BASE */
/* SYSTEM: ALL */
/* KEYS: ODS LISTING DOCUMENT */
/* PROCS: DOCUMENT */
/* DATA: */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: */
/* */
/****************************************************************/
/* Create a document using Sashelp.CLASS data set. */
ods document name=docsamp;
proc print data=sashelp.class;
run;
proc print data=sashelp.class;
run;
proc means data=sashelp.class;
run;
ods document close;
/* Listing output is open by default. */
/* Open and modify the document called DOCSAMP. */
proc document name=docsamp;
/* Verify that the location is at the root of the DOCSAMP document. */
dir; run;
/* Verify the contents of DOCSAMP. */
list / levels=all; run;
/* Make a new directory called HELLO that resides within */
/* the DOCSAMP document. */
make hello; run;
/* Verify that the new directory was created. */
list / levels=all; run;
/* Create a label for the PRINT directory. */
setlabel print "my label"; run;
/* Verify label was added to the PRINT directory! */
list / levels=all details; run;
/* Delete the PRINT directory. */
delete print; run;
/* Verify that the PRINT directory was deleted. */
list / levels=all; run;
/* Copy the HELLO directory to the current location. Since */
/* HELLO already exists, HELLO#2 is created. */
copy hello to ^; run;
/* Verify that HELLO#2 is created using the COPY statement. */
list / levels=all; run;
/* Move PRINT#1 directory to a directory called MYPRINT. */
move print#1 to myprint; run;
/* Verify that the PRINT#1 directory was moved to MYPRINT. */
list / levels=all; run;
/* Rename the MYPRINT directory to NEWPRINT. */
rename myprint#1 to newprint; run;
/* Verify that the MYPRINT directory gets renamed to NEWPRINT. */
list / levels=all; run;
/* Import data set CLASS to current document. Within a */
/* document, data sets are referenced as TABLES. */
import data=sashelp.class to ^; run;
/* Verify that the table gets imported into document. */
list / levels=all; run;
/* Create a Note entry into the document. Notes are */
/* references as NOTE. */
note note1 'This is the text for Note #1'; run;
/* Verify that Note gets created. */
list / levels=all; run;
/* Change to \newprint#1 directory. */
dir \newprint#1; run;
/* Verify that the directory was changed. */
dir; run;
/* Add headers to your output. */
obbnote1 print#1 'Header Note #1' /just=left; run;
obbnote2 print#1 'Header Note #2' /just=center; run;
obbnote3 print#1 'Header Note #3' /just=right; run;
/* Verify that the Headers are replayed in the output. */
replay; run;
/* Add footers to your output. */
obanote1 print#1 'Footer Note #1' /just=center; run;
obanote2 print#1 'Footer Note #2' /just=right; run;
obanote3 print#1 'Footer Note #3' /just=left; run;
/* Verify that the footers are replayed in the output. */
replay; run;
/* Add titles to your output. */
obtitle1 print#1 'Header Title #1'; run;
obtitle2 print#1 'Header Title #2'; run;
obtitle3 print#1 'Header Title #3'; run;
/* Verify that the titles exist. */
replay; run;
/* Add footnotes to your output. */
obfootn1 print#1 'Footer #1'; run;
obfootn2 print#1 'Footer #2'; run;
obfootn3 print#1 'Footer #3'; run;
/* Verify that the footnotes exist. */
replay; run;
/* Change to MEANS directory. */
dir \work.docsamp\means#1; run;
/* Change the PROC MEANS procedure title. */
obstitle summary#1 'Change Proc Means proc title'; run;
/* Verify that the proc title has changed. */
replay; run;
/* End of PROC DOCUMENT */
quit;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Obs Name Sex Age Height Weight
1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
7 Jane F 12 59.8 84.5
8 Janet F 15 62.5 112.5
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
11 Joyce F 11 51.3 50.5
12 Judy F 14 64.3 90.0
13 Louise F 12 56.3 77.0
14 Mary F 15 66.5 112.0
15 Philip M 16 72.0 150.0
16 Robert M 12 64.8 128.0
17 Ronald M 15 67.0 133.0
18 Thomas M 11 57.5 85.0
19 William M 15 66.5 112.0
Obs Name Sex Age Height Weight
1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
7 Jane F 12 59.8 84.5
8 Janet F 15 62.5 112.5
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
11 Joyce F 11 51.3 50.5
12 Judy F 14 64.3 90.0
13 Louise F 12 56.3 77.0
14 Mary F 15 66.5 112.0
15 Philip M 16 72.0 150.0
16 Robert M 12 64.8 128.0
17 Ronald M 15 67.0 133.0
18 Thomas M 11 57.5 85.0
19 William M 15 66.5 112.0
The MEANS Procedure
Variable N Mean Std Dev Minimum Maximum
--------------------------------------------------------------------
Age 19 13.3157895 1.4926722 11.0000000 16.0000000
Height 19 62.3368421 5.1270752 51.3000000 72.0000000
Weight 19 100.0263158 22.7739335 50.5000000 150.0000000
--------------------------------------------------------------------
\Work.Docsamp\
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Print#1 Dir
10 \Print#1\Print#1 Report
11 \Print#2 Dir
12 \Print#2\Print#1 Report
13 \Means#2 Dir
14 \Means#2\Summary#1 Table
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Print#1 Dir
10 \Print#1\Print#1 Report
11 \Print#2 Dir
12 \Print#2\Print#1 Report
13 \Means#2 Dir
14 \Means#2\Summary#1 Table
15 \hello#3 Dir
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Size
Obs Path Type in Bytes Created
------------------------------------------------------------------------
1 \Means#1 Dir 06JUL2005:14:32:17
2 \Means#1\Summary#1 Table 322 06JUL2005:14:32:17
3 \hello#1 Dir 06JUL2005:14:32:17
4 \hello#2 Dir 06JUL2005:14:32:17
5 \newprint#1 Dir 06JUL2005:14:32:17
6 \newprint#1\Print#1 Report 570 06JUL2005:14:32:16
7 \CLASS#1 Table 535 06JUL2005:14:32:17
8 \note1#1 Note 163 06JUL2005:14:32:17
9 \Print#1 Dir 06JUL2005:14:32:55
10 \Print#1\Print#1 Report 570 06JUL2005:14:32:56
11 \Print#2 Dir 06JUL2005:14:32:56
12 \Print#2\Print#1 Report 570 06JUL2005:14:32:56
13 \Means#2 Dir 06JUL2005:14:32:56
14 \Means#2\Summary#1 Table 322 06JUL2005:14:32:56
15 \hello#3 Dir 06JUL2005:14:32:56
Obs Modified Symbolic Link Template Label
----------------------------------------------------------------------
1 06JUL2005:14:32:17 The Means
Procedure
2 06JUL2005:14:32:17 base.summary Summary
statistics
3 06JUL2005:14:32:17
4 06JUL2005:14:32:17
5 06JUL2005:14:32:17 The Print
Procedure
6 06JUL2005:14:32:16 Base. Data Set
Document. SASHELP.CLASS
Table
7 06JUL2005:14:32:17 Base.
Document.
Table
8 06JUL2005:14:32:17
9 06JUL2005:14:32:56 The Print
Procedure
10 06JUL2005:14:32:56 Base. Data Set
Document. SASHELP.CLASS
Table
11 06JUL2005:14:32:56 my label
12 06JUL2005:14:32:56 Base. Data Set
Document. SASHELP.CLASS
Table
Obs Modified Symbolic Link Template Label
----------------------------------------------------------------------
13 06JUL2005:14:32:56 The Means
Procedure
14 06JUL2005:14:32:56 base.summary Summary
statistics
15 06JUL2005:14:32:56
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Print#1 Dir
10 \Print#1\Print#1 Report
11 \Means#2 Dir
12 \Means#2\Summary#1 Table
13 \hello#3 Dir
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Print#1 Dir
10 \Print#1\Print#1 Report
11 \Means#2 Dir
12 \Means#2\Summary#1 Table
13 \hello#3 Dir
14 \hello#4 Dir
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Means#2 Dir
10 \Means#2\Summary#1 Table
11 \hello#3 Dir
12 \hello#4 Dir
13 \myprint#1 Dir
14 \myprint#1\Print#1 Report
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Means#2 Dir
10 \Means#2\Summary#1 Table
11 \hello#3 Dir
12 \hello#4 Dir
13 \newprint#2 Dir
14 \newprint#2\Print#1 Report
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Means#2 Dir
10 \Means#2\Summary#1 Table
11 \hello#3 Dir
12 \hello#4 Dir
13 \newprint#2 Dir
14 \newprint#2\Print#1 Report
15 \CLASS#2 Table
Listing of: \Work.Docsamp\
Order by: Insertion
Number of levels: All
Obs Path Type
------------------------------------------------------------------------
1 \Means#1 Dir
2 \Means#1\Summary#1 Table
3 \hello#1 Dir
4 \hello#2 Dir
5 \newprint#1 Dir
6 \newprint#1\Print#1 Report
7 \CLASS#1 Table
8 \note1#1 Note
9 \Means#2 Dir
10 \Means#2\Summary#1 Table
11 \hello#3 Dir
12 \hello#4 Dir
13 \newprint#2 Dir
14 \newprint#2\Print#1 Report
15 \CLASS#2 Table
16 \note1#2 Note
\Work.Docsamp\newprint#1
Header Title #1
Header Title #2
Header Title #3
Header Note #1
Header Note #2
Header Note #3
Obs Name Sex Age Height Weight
1 Alfred M 14.000000 69.000000 112.500000
2 Alice F 13.000000 56.500000 84.000000
3 Barbara F 13.000000 65.300000 98.000000
4 Carol F 14.000000 62.800000 102.500000
5 Henry M 14.000000 63.500000 102.500000
6 James M 12.000000 57.300000 83.000000
7 Jane F 12.000000 59.800000 84.500000
8 Janet F 15.000000 62.500000 112.500000
9 Jeffrey M 13.000000 62.500000 84.000000
10 John M 12.000000 59.000000 99.500000
11 Joyce F 11.000000 51.300000 50.500000
12 Judy F 14.000000 64.300000 90.000000
13 Louise F 12.000000 56.300000 77.000000
14 Mary F 15.000000 66.500000 112.000000
15 Philip M 16.000000 72.000000 150.000000
16 Robert M 12.000000 64.800000 128.000000
17 Ronald M 15.000000 67.000000 133.000000
18 Thomas M 11.000000 57.500000 85.000000
19 William M 15.000000 66.500000 112.000000
Footer Note #1
Footer Note #2
Footer Note #3
Footer #1
Footer #2
Footer #3
Header Title #1
Header Title #2
Header Title #3
Header Note #1
Header Note #2
Header Note #3
Obs Name Sex Age Height Weight
1 Alfred M 14.000000 69.000000 112.500000
2 Alice F 13.000000 56.500000 84.000000
3 Barbara F 13.000000 65.300000 98.000000
4 Carol F 14.000000 62.800000 102.500000
5 Henry M 14.000000 63.500000 102.500000
6 James M 12.000000 57.300000 83.000000
7 Jane F 12.000000 59.800000 84.500000
8 Janet F 15.000000 62.500000 112.500000
9 Jeffrey M 13.000000 62.500000 84.000000
10 John M 12.000000 59.000000 99.500000
11 Joyce F 11.000000 51.300000 50.500000
12 Judy F 14.000000 64.300000 90.000000
13 Louise F 12.000000 56.300000 77.000000
14 Mary F 15.000000 66.500000 112.000000
15 Philip M 16.000000 72.000000 150.000000
16 Robert M 12.000000 64.800000 128.000000
17 Ronald M 15.000000 67.000000 133.000000
18 Thomas M 11.000000 57.500000 85.000000
19 William M 15.000000 66.500000 112.000000
Footer Note #1
Footer Note #2
Footer Note #3
Footer #1
Footer #2
Footer #3
Header Title #1
Header Title #2
Header Title #3
Header Note #1
Header Note #2
Header Note #3
Obs Name Sex Age Height Weight
1 Alfred M 14.000000 69.000000 112.500000
2 Alice F 13.000000 56.500000 84.000000
3 Barbara F 13.000000 65.300000 98.000000
4 Carol F 14.000000 62.800000 102.500000
5 Henry M 14.000000 63.500000 102.500000
6 James M 12.000000 57.300000 83.000000
7 Jane F 12.000000 59.800000 84.500000
8 Janet F 15.000000 62.500000 112.500000
9 Jeffrey M 13.000000 62.500000 84.000000
10 John M 12.000000 59.000000 99.500000
11 Joyce F 11.000000 51.300000 50.500000
12 Judy F 14.000000 64.300000 90.000000
13 Louise F 12.000000 56.300000 77.000000
14 Mary F 15.000000 66.500000 112.000000
15 Philip M 16.000000 72.000000 150.000000
16 Robert M 12.000000 64.800000 128.000000
17 Ronald M 15.000000 67.000000 133.000000
18 Thomas M 11.000000 57.500000 85.000000
19 William M 15.000000 66.500000 112.000000
Footer Note #1
Footer Note #2
Footer Note #3
Footer #1
Footer #2
Footer #3
Header Title #1
Header Title #2
Header Title #3
Header Note #1
Header Note #2
Header Note #3
Obs Name Sex Age Height Weight
1 Alfred M 14.000000 69.000000 112.500000
2 Alice F 13.000000 56.500000 84.000000
3 Barbara F 13.000000 65.300000 98.000000
4 Carol F 14.000000 62.800000 102.500000
5 Henry M 14.000000 63.500000 102.500000
6 James M 12.000000 57.300000 83.000000
7 Jane F 12.000000 59.800000 84.500000
8 Janet F 15.000000 62.500000 112.500000
9 Jeffrey M 13.000000 62.500000 84.000000
10 John M 12.000000 59.000000 99.500000
11 Joyce F 11.000000 51.300000 50.500000
12 Judy F 14.000000 64.300000 90.000000
13 Louise F 12.000000 56.300000 77.000000
14 Mary F 15.000000 66.500000 112.000000
15 Philip M 16.000000 72.000000 150.000000
16 Robert M 12.000000 64.800000 128.000000
17 Ronald M 15.000000 67.000000 133.000000
18 Thomas M 11.000000 57.500000 85.000000
19 William M 15.000000 66.500000 112.000000
Footer Note #1
Footer Note #2
Footer Note #3
Footer #1
Footer #2
Footer #3
NEW UPDATED MASTER FILE
Change Proc Means proc title
Variable N Mean Std Dev Minimum Maximum
--------------------------------------------------------------------
Age 19 13.3157895 1.4926722 11.0000000 16.0000000
Height 19 62.3368421 5.1270752 51.3000000 72.0000000
Weight 19 100.0263158 22.7739335 50.5000000 150.0000000
--------------------------------------------------------------------
This sample demonstrates the basic functionality of the DOCUMENT procedure.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> DOCUMENT
|
Date Modified: | 2014-05-07 09:26:02 |
Date Created: | 2005-05-23 13:48:10 |
Operating System and Release Information
SAS System | Base SAS | All | 9.1 TS1M3 | n/a |