| Return to ODS Packages
|
You can use an ODS package template with a package to provide information about metadata, publish properties, and internal paths, and specify whether to clear temporary files on close. ODS package templates are preproduction for SAS 9.2.
A package template defines how to create a package. It provides metadata for the package and all the controls to publish the package. A package template also defines paths to be created within the package. Each of the output files a destination can create can be directed to any path. Files can also be sorted into paths based on mimetypes. A package template gives the ability to create packages with structure.
Issue the following SAS statements to get a list of the package templates that you have:
proc template; list packages;
By default, PROC TEMPLATE lists the packages in SASHELP.TMPLMST and SASUSER.TEMPLAT. Typically, SASHELP.TMPLMST is a read-only item store for the SAS packages, and SASUSER.TEMPLAT is the item store for user-defined packages.
Tip: To specify a user-defined package template that is stored in an item store other than SASUSER.TEMPLAT, assign the item store to the ODS search path with the ODS PATH statement.
proc template; source packages.default;
The DEFINE PACKAGE statement, package attribute statements, and path statements together create a package definition. Many of these language elements are explained in more detail in the SAS online documentation; see the topic about using the TEMPLATE procedure to create markup language tagsets.
The syntax is as follows:
DEFINE PACKAGE package-path
</STORE=libref.template-store
<(READ | WRITE | UPDATE)>>;
<ABSTRACT="string";>
<ARCHIVE_NAME="string";>
<CLEAR=YES|NO;>
<DEFAULT_PATH="string";>
<DESCRIPTION="string";>
<NAMEVALUE='name="value"...name-n="value-n" ';>
NOTES 'text';
<PATH 'path_string' FILES=value(s) MIME_TYPES=value(s);>
<PUBLISH=(transport) PROPERTIES(property="value"...property-n="value-n");>
END;
define package packages.mypkg;
NOTE: You can use the ODS PATH statement to control the item store where the package definition will be stored. Optionally, you can use the /STORE= option to provide a specific item store name.
Tip: Names are not case sensitive. However, PROC TEMPLATE frequently uppercases the first letter to make things more readable.
define package packages.mypkg /store=sasuser.templat (update);
The following statements specify package attributes, path, and publish:
NameValue='name="test" stuff="junk"';
files = body contents frame
The transports and the properties are documented in the SAS Integration Technologies Developer's Guide.
Here's an example:
publish=archive properties(archive_name="test.spk" archive_path="./");
proc template;
define tagset tagsets.test;
parent=tagsets.html4;
default_mimetype = "text/html";
stylesheet_mimetype = "text/css";
end;
run;
proc template;
define package packages.test;
/* publish info */
/* where to publish to. archive, webdav, queue, email, etc. */
/* publish properties, key value pairs. */
publish = Archive properties ( archive_path="./" archive_name="test" );
Description = "This is my description";
Abstract = "This is my abstract";
/* clean up the temporary files */
clear = yes;
NameValue = 'path="./"';
/* Paths. Where to put stuff inside the package */
default_path = "./";
path './'
files = body contents frame code data
mimetypes = "text/html"
;
path 'style/'
mimetypes = "text/css";
;
path 'style/'
files = stylesheet
;
path 'images/'
mimetypes = "image/bmp image/gif image/jpg image/png"
;
path 'drawing/'
mimetypes = "image/svg+xml"
;
path 'rtf/'
mimetypes = "text/rtf text/richtext"
;
end;
run;
/* list the packages, and source the one we just created */
proc template;
list packages;
source packages.test;
run;
ods listing close;
goptions dev=gif xpixels=480 ypixels=320;
ods package open template=test namevalue = 'stuff="junk"';
ods tagsets.test package file="t2.html" stylesheet="t2.css";
proc gplot data=sashelp.class;
plot height*weight;
by name;
run;
quit;
ods tagsets.test close;
/* add the test case to the package */
ods package add file="t15.sas" path="sas" mimetype="text/plain";
/* create the package */
ods package publish archive properties(archive_name="test.spk" archive_path="./");
/* close the package and clean up */
ods package close;
Test.spk is the package created by this program, and its contents looks like this:
unzip -l test.spk
Archive: test.spk
Length Date Time Name
-------- ---- ---- ----
44 08-15-06 20:54 PackageMetaData
1716 08-15-06 20:54 sas/t15.sas
3003 08-15-06 20:54 images/gplot18.gif
2991 08-15-06 20:54 images/gplot17.gif
2995 08-15-06 20:54 images/gplot16.gif
3006 08-15-06 20:54 images/gplot15.gif
2976 08-15-06 20:54 images/gplot14.gif
2998 08-15-06 20:54 images/gplot13.gif
2979 08-15-06 20:54 images/gplot12.gif
2968 08-15-06 20:54 images/gplot11.gif
2983 08-15-06 20:54 images/gplot10.gif
2979 08-15-06 20:54 images/gplot9.gif
2981 08-15-06 20:54 images/gplot8.gif
2986 08-15-06 20:54 images/gplot7.gif
2973 08-15-06 20:54 images/gplot6.gif
2958 08-15-06 20:54 images/gplot5.gif
2992 08-15-06 20:54 images/gplot4.gif
2980 08-15-06 20:54 images/gplot3.gif
2998 08-15-06 20:54 images/gplot2.gif
2965 08-15-06 20:54 images/gplot1.gif
2973 08-15-06 20:54 images/gplot.gif
5519 08-15-06 20:54 ./t2.html
22869 08-15-06 20:54 style/t2.css
-------- -------
85116 23 files