Previous Page | Next Page

Dictionary of ODS Language Statements

ODS PACKAGE Statement



The ODS PACKAGE statement opens, adds to, publishes, or closes one SAS Output Delivery System (ODS) package object.
Valid: anywhere
Category: Data Access
Requirement: The destination must specify the PACKAGE option to connect with the package.
See also: ODS packages are used primarily with the Publishing Framework. For complete information on the Publishing Framework feature of SAS Integration Technologies, see SAS Publishing Framework: Developer's Guide.

Syntax
Required Arguments
Options
Details
Examples
Example 1: Creating an ODS Package
Example 2: Listing Package Contents with the ODS DOCUMENT Statement
See Also

Syntax

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>;


Required Arguments

ADD

adds a file or data set to an ODS package using the specified Multipurpose Internet Mail Extensions (MIME) type.

Requirement: When using the ADD argument, you must also use the MIMETYPE=, FILE=, or DATA= arguments to specify a file or data set and a MIME type.
FILE="file-specification" <TEXT | BINARY>

specifies the file that you want to add to an ODS package.

file-specification

specifies one of the following:

external-file

is the name of an external file to add.

Requirement: You must enclose external-file in quotation marks.
fileref

is a file reference that has been assigned to an external file. Use the FILENAME statement to assign a fileref.

TEXT

specifies that the file is a text file.

BINARY

specifies that the file is a binary file.

Default: If you do not specify the TEXT or BINARY values, then file is text if the mimetype is text, and binary if the mimetype is anything else.
Example: Use the following statement to add the Test.Sas file as plain text to the ODS package directory SAS:
ods package add file="test.sas" mimetype="text/plain" path="sas/"; 
Restriction: You can use the FILE= argument only with the ADD argument.
Restriction: You cannot add a file and a data set to an ODS package.
DATA=member-specification

specifies the data set that you want to add to an ODS package. member-specification can be in the form libname.membername or membername.

Restriction: You can use the DATA= argument only with the ADD argument.
Restriction: You cannot add a file and a data set to an ODS package.
MIMETYPE=''string"

specifies the Multipurpose Internet Mail Extensions (MIME) type for the file or data set that you are adding to an ODS package.

Restriction: You can use the MIMETYPE= argument only with the ADD argument.
OPEN EXPIRATION= <'expiration-date'>

creates the ODS package object to which the ODS destinations can connect. The ODS package object holds the package metadata and tracks the locations of any files that are added to the package metadata.

Example: The following ODS PACKAGE statement opens an unnamed package with an abstract and a description.
  ods package open abstract="this is my abstract" description="this is 
       description";
PUBLISH EXPIRATION=<'expiration-date'>

builds the ODS package and sends it to the chosen delivery transport.

expiration-date

specifies an expiration date for the package. The date must be a SAS date value.

Requirement: expiration-date must be enclosed in quotation marks.
CLOSE

deletes the package object. As long as you have not closed a package, you can publish it as many ways and times as you want.

Tip: Use the CLEAR option to remove files that have been added to the package.
transport

specifies the deliver transport to use with the PUBLISH action. transport can be one of the following:

ARCHIVE PROPERTIES(transport-property-1="value-1"... transport-property-n="value-n"")

publishes a package to an archive. For a list of transport properties and their values, see the section on transport properties in the SAS Publishing Framework: Developer's Guide.

Example: The following statement publishes an ODS package to the archive Test.spk:
ods package publish archive  properties(archive_path="./" 
     archive_name="test.spk");
EMAIL PROPERTIES(transport-property-1="value-1" . . . transport-property-n="value-n") ADDRESSES("e-mail-address-1" . . . "e-mail-address-n")

publishes a package to one or more e-mail addresses. For a list of transport properties and their values, see the section on transport properties in the SAS Publishing Framework: Developer's Guide.

Example: The following statement publishes an ODS package to the e-mail addresses your.email@company.com and your.second.email@company.com:
ods package publish email  addresses("your.email@company.com" 
     "your.second.email@company.com") 
    properties(archive_name="testPackage" archive_path="./"); 
QUEUE PROPERTIES(transport-property-1="value-1" . . . transport-property-n="value-n") QUEUES("queue-1" . . . "queue-n")

publishes a package to one or more message queues. For a list of transport properties and their values, see the section on transport properties in the SAS Publishing Framework: Developer's Guide.

SUBSCRIBERS PROPERTIES(transport-property-1="value-1" . . . transport-property-n="value-n")

publishes a package to subscribers who are associated with the specified channel. For a list of transport properties and their values, see the section on transport properties in the SAS Publishing Framework: Developer's Guide.

WEBDAV PROPERTIES(transport-property-1="value-1" . . . transport-property-n="value-n")

publishes a package to a WebDAV-compliant server. For a list of transport properties and their values, see the section on transport properties in the SAS Publishing Framework: Developer's Guide.


Options

ABSTRACT=string

specifies a string for the abstract metadata of the package or file.

Restriction: You can use the ABSTRACT= option only with the ADD or OPEN arguments.
CLEAR

specifies that all files that were automatically added to the package will be removed from the location to which ODS wrote them.

Restriction: You can use the CLEAR option only with the CLOSE argument.
DESCRIPTION=string

specifies a string for the description metadata for the package or file.

Restriction: You can use the DESCRIPTION= option only with the ADD or OPEN arguments.
(name)

specifies the name of a package. Naming a package enables you to open more than one package at a time. Each destination can connect with any package by specifying the package name in the same way.

Requirement: You must place name directly after the PACKAGE keyword in the ODS PACKAGE statement.
Requirement: name must be enclosed in parenthesis.
NAMEVALUE="<name-1="value-1" . . . name-n="value-n">"

specifies a string of name/value pairs for the name/value metadata on the package or file.

Restriction: The NAMEVALUE= option can be used only with the ADD or OPEN arguments.
PATH="path-specification"

places the file or data set at the specified pathname within an ODS package.

Restriction: You can use the PATH= option only with the ADD argument.
Example: Use the following statement to add the Test.Sas file as plain text to the ODS package directory SAS:
ods package add file="test.sas" mimetype="text/plain" path="sas/"; 
TEMPLATE=

specifies the name of a package template to use.

Restriction: You can use the TEMPLATE= option only with the ADD or OPEN arguments.

Details

A package is a container for digital content that is generated or collected for delivery to a consumer. ODS packages allow ODS destinations to use the SAS Publishing Framework. An ODS package is an object that contains output files and data sets that are associated with any open ODS destinations. ODS packages hold the package metadata and track the output from any active destinations that connect to it. After the destinations are closed, the package can be published to any of the publish destinations. You can continue to use the package, or you can close it. A package remains active until explicitly closed.


Examples


Example 1: Creating an ODS Package


Program Description:

The following example creates a simple ODS package. The package is created in your default directory, if you do not specify a different directory.


Program

 Note about code
ods listing close;
goptions dev=gif xpixels=480 ypixels=320;
 Note about code
ods package open;
ods html package;
 Note about code
 proc gplot data=sashelp.class;
     plot height*weight;
     by name;
 run;
 quit;    
ods html close;
 Note about code
ods package publish archive properties(archive_name="SimpleExample.zip" archive_path="./");
ods package close;

Program Output

Simple ODS Package

[Simple ODS Package]


Example 2: Listing Package Contents with the ODS DOCUMENT Statement


Program Description:

In the following program, PROC DOCUMENT imports the archive SimpleExample.zip into a PROC DOCUMENT package named myPackage.You can then use PROC DOCUMENT to list the contents and details of the package.


Program

 Note about code
ods listing;
 
 Note about code
proc document name=archive;
   import archive="SimpleExample.zip" to myPackage;
 
   list/levels=all;
   run;
 Note about code
   dir myPackage;
   list 'sashtml.htm'n/details;
   run;
quit;

Program Output

Listing of Work.Archive and Details of HTM File

                                         The SAS System 

Listing of: \Work.Archive\
Order by: Insertion
Number of levels: All

  Obs    Path                                                                           Type
---------------------------------------------------------------- 
       1 \myPackage#1                                                                   Dir
       2 \myPackage#1\'sashtml.htm'n#1                                                  File
       3 \myPackage#1\'gplot.gif'n#1                                                    File
       4 \myPackage#1\'gplot1.gif'n#1                                                   File
       5 \myPackage#1\'gplot2.gif'n#1                                                   File
       6 \myPackage#1\'gplot3.gif'n#1                                                   File
       7 \myPackage#1\'gplot4.gif'n#1                                                   File
       8 \myPackage#1\'gplot5.gif'n#1                                                   File
       9 \myPackage#1\'gplot6.gif'n#1                                                   File
      10 \myPackage#1\'gplot7.gif'n#1                                                   File
      11 \myPackage#1\'gplot8.gif'n#1                                                   File
      12 \myPackage#1\'gplot9.gif'n#1                                                   File
      13 \myPackage#1\'gplot10.gif'n#1                                                  File
      14 \myPackage#1\'gplot11.gif'n#1                                                  File
      15 \myPackage#1\'gplot12.gif'n#1                                                  File
      16 \myPackage#1\'gplot13.gif'n#1                                                  File
      17 \myPackage#1\'gplot14.gif'n#1                                                  File
      18 \myPackage#1\'gplot15.gif'n#1                                                  File
      19 \myPackage#1\'gplot16.gif'n#1                                                  File
      20 \myPackage#1\'gplot17.gif'n#1                                                  File
      21 \myPackage#1\'gplot18.gif'n#1                                                  File
                                                    The SAS System       

Listing of: \Work.Archive\myPackage#1\'sashtml.htm'n#1
Order by: Insertion
Number of levels: 1

              Size
Type        in Bytes         Created             Modified      Symbolic Link    Template
----------------------------------------------------------------
File              4762  17OCT2008:14:32:52  17OCT2008:14:32:52

Label
----------------------------------------------------------------
MARKUP, Proc, Gplot, GPLOT, Plot of Height by Weight, GPLOT1, Plot of Height by Weight, GPLOT2,
Plot of Height by Weight, GPLOT3, Plot of Height by Weight, GPLOT4, Plot of Height by Weight,
GPLOT5, Plot of Height by Weight, GPLOT6, Plot of Height by Weigh

See Also

Previous Page | Next Page | Top of Page