When running a stored process and creating a transient package, it is possible to insert multiple files into the package. This SAS Note provides an example.
The stored process example below creates a transient package that contains the following files: temp.xls, test.sas7bdat, temp.htm, temp2.xls, temp.csv, temp.rtf, and test.txt.
The %STPBEGIN macro creates a temporary directory and directs ODS to put its output in that directory. Anything in that directory ultimately ends up in the result package. After the package is created, the files are deleted from the directory, and the directory is removed.
The path to that directory is stored in the global macro variable _STPWORK and is available for use.
Stored Process Example:
/* This stored process creates multiple files and inserts */
/* them in the result package */
*ProcessBody;
%let _ODSDEST=tagsets.ExcelXp;
%let _ODSOPTIONS=file="temp.xls";
%let _ODSSTYLESHEET=;
%STPBEGIN;
/* Files in the "&_STPWORK" directory will be copied to the result */
/* package. */
libname stpwork "&_STPWORK";
/* Insert the "temp.xls" file using "tagsets.ExcelXp" */
proc print data=sashelp.class;
run;
/* Insert a SAS data set in the result package */
data stpwork.test;
set sashelp.class;
run;
ods html file='temp.htm' path="&_STPWORK";
/* Insert the "temp.htm" file */
proc print data=sashelp.class;
run;
ods html close;
/* Insert "temp2.xls". This is an HTML file that */
/* is disguised as a XLS file. Excel will be used */
/* to open the file. */
ods html file='temp2.xls' path="&_STPWORK";
proc print data=sashelp.class;
run;
ods html close;
/* Insert the "temp.csv" file */
ods csv file='temp.csv' path="&_STPWORK";
proc print data=sashelp.class;
run;
ods csv close;
/* Insert the "temp.rtf" file */
ods rtf file='temp.rtf' path="&_STPWORK";
proc print data=sashelp.class;
run;
ods rtf close;
/* Insert "test.txt" file */
filename stpout "&_STPWORK\test.txt";
data _null_;
file stpout;
put "This is a test file inserted in the result package";
run;
%STPEND;
Operating System and Release Information
SAS System | SAS Integration Technologies | Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP1 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP1 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP1 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP1 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP1 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP1 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP1 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP1 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP1 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP1 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP1 | |
HP-UX IPF | 9.1 TS1M3 SP1 | |
Linux on Itanium | 9.1 TS1M3 SP1 | |
Linux | 9.1 TS1M3 SP1 | |
64-bit Enabled Solaris | 9.1 TS1M3 SP1 | |
64-bit Enabled HP-UX | 9.1 TS1M3 SP1 | |
64-bit Enabled AIX | 9.1 TS1M3 SP1 | |
Tru64 UNIX | 9.1 TS1M3 SP1 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.