| Return to ODS Packages
|
The ODS PACKAGE statement opens, adds to, publishes, or closes one SAS Output Delivery System (ODS) package object. The ODS PACKAGE statement is scheduled for production in SAS 9.2.
The syntax for the ODS PACKAGE statement is as follows:
ODS PACKAGE<(name)> OPEN <options>;
ODS PACKAGE<(name)> ADD FILE="file-specification" | DATA=member-specification
MIMETYPE="string" <PATH="path-specification"> <options>;
ODS PACKAGE<(name)> PUBLISH transport
PROPERTIES(transport-property-1="value-1". . . transport-property-n="value-n");
ODS PACKAGE<(name)> CLOSE <CLEAR>;
ODS PACKAGE<(name)>;
A name is optional. A name enables more than one package to be open at a time. Each destination can connect with any package it wishes by specifying the package name in the same way.
Actions include the following:
Here's an example:
ods package open abstract="this is my abstract"
description="this is my description";
The options for ODS PACKAGE OPEN statement are basically the metadata for the package:
See the options for ODS PACKAGE OPEN. You can use Description=, Abstract=, NameValue=, or Template= to specify the metadata for the file or data set that you add.
Here's an example:
ods package add file="test.sas" mimetype="text/plain" path="sas/";
For information about transport properties and their values, see SAS Integration Technologies Developer's Guide. You can supply more than one property.
Transports on the PACKAGE statement include the following. Notice that two of the transports (EMAIL and QUEUE) take an additional argument.
ods package publish archive
properties(archive_path="./" archive_name="test.spk");
ods package publish email
addresses("eric.gebhart@sas.com" "saseag@sas.com")
properties(archive_name="testPackage" archive_path="./");
Here's an example:
ods package close clear;
This example demonstrates the arguments for the ADD action.
ods package add file="test.sas" mimetype="text/plain" path="sas/";
/* Make a fileref */
%filename (t, t20, sas);
ods package open;
/* Add this program and put it in the sas directory */
ods package add file="t20.sas" path="sas" mimetype="text/plain";
/* Add this program as a fileref in root directory of package */
ods package add file=t;
/* Add a data set from a named library */
ods package add data=sashelp.class;
/* Create a temporary data set in the default library (Work) */
proc sort data=sashelp.class out=foo;
by age;
run;
/* Add a data set from the default library (Work) */
ods package add data=foo;
/* Create the archive */
ods package publish archive properties(archive_name="t20.spk"
archive_path="./");
/* Delete the ods package object */
ods package close;
ods package open;
ods html package file="test_1.html" newfile=output;
options obs=6;
proc sort data=sashelp.class out=foo;
by age;
run;
proc print ;
by age;
run;
ods html close;
ods package add file="test.sas" mimetype="text/plain" path="SAS";
ods package publish archive properties(archive_name="test.spk" archive_path="./");
ods package close clear;
The package created by the above example code looks like this:
unzip -l test.spk
Archive: test.spk
Length Date Time Name
-------- ---- ---- ----
25 08-08-06 21:02 PackageMetaData
126 08-08-06 21:02 SAS/test.sas
24966 08-08-06 21:02 test_6.html
25494 08-08-06 21:02 test_5.html
25492 08-08-06 21:02 test_4.html
25310 08-08-06 21:02 test_3.html
25669 08-08-06 21:02 test_2.html
25158 08-08-06 21:02 test_1.html
-------- -------
152240 8 files
ods listing close;
goptions dev=gif xpixels=480 ypixels=320;
ods package open;
ods package(foo) open;
ods rtf package file="test2.rtf";
ods html package(foo) file="test2_1.html" newfile=output;
*options obs=5;
proc sort data=sashelp.class out=foo;
by age;
run;
proc print ;
by age;
run;
proc gplot data=sashelp.class;
plot height*weight;
by name;
run;
quit;
ods html close;
ods package add file="test2.sas" mimetype="text/plain" path="SAS";
ods package(foo) add file="test2.sas" mimetype="text/plain" path="SAS";
ods package publish archive properties(archive_name="testRTF.spk" archive_path="./");
ods package(foo) publish archive properties(archive_name="testHTML.spk" archive_path="./");
ods package(foo) close clear;
ods package close clear;
The two archives the example code publish look like this:
unzip -l testHTML.spk
Archive: testHTML.spk
Length Date Time Name
-------- ---- ---- ----
25 08-08-06 21:19 PackageMetaData
1004 08-08-06 21:19 SAS/test2.sas
3009 08-08-06 21:19 gplot18.gif
24103 08-08-06 21:19 test2_25.html
2998 08-08-06 21:19 gplot17.gif
24095 08-08-06 21:19 test2_24.html
3002 08-08-06 21:19 gplot16.gif
24095 08-08-06 21:19 test2_23.html
3014 08-08-06 21:19 gplot15.gif
24095 08-08-06 21:19 test2_22.html
2983 08-08-06 21:19 gplot14.gif
24095 08-08-06 21:19 test2_21.html
2997 08-08-06 21:19 gplot13.gif
24095 08-08-06 21:19 test2_20.html
2986 08-08-06 21:19 gplot12.gif
24095 08-08-06 21:19 test2_19.html
2979 08-08-06 21:19 gplot11.gif
24095 08-08-06 21:19 test2_18.html
2990 08-08-06 21:19 gplot10.gif
24095 08-08-06 21:19 test2_17.html
2986 08-08-06 21:19 gplot9.gif
24094 08-08-06 21:19 test2_16.html
3002 08-08-06 21:19 gplot8.gif
24094 08-08-06 21:19 test2_15.html
2991 08-08-06 21:19 gplot7.gif
24094 08-08-06 21:19 test2_14.html
2988 08-08-06 21:19 gplot6.gif
24094 08-08-06 21:19 test2_13.html
2966 08-08-06 21:19 gplot5.gif
24094 08-08-06 21:19 test2_12.html
3001 08-08-06 21:19 gplot4.gif
24094 08-08-06 21:19 test2_11.html
2995 08-08-06 21:19 gplot3.gif
24093 08-08-06 21:19 test2_10.html
3008 08-08-06 21:19 gplot2.gif
24093 08-08-06 21:19 test2_9.html
2972 08-08-06 21:19 gplot1.gif
24093 08-08-06 21:19 test2_8.html
2981 08-08-06 21:19 gplot.gif
24114 08-08-06 21:19 test2_7.html
24966 08-08-06 21:19 test2_6.html
25494 08-08-06 21:19 test2_5.html
25492 08-08-06 21:19 test2_4.html
25310 08-08-06 21:19 test2_3.html
25669 08-08-06 21:19 test2_2.html
25158 08-08-06 21:19 test2_1.html
-------- -------
667786 46 files
unzip -l testRTF.spk
Archive: testRTF.spk
Length Date Time Name
-------- ---- ---- ----
25 08-08-06 21:19 PackageMetaData
1004 08-08-06 21:19 SAS/test2.sas
164261 08-08-06 21:19 test2.rtf
-------- -------
165290 3 files