Your SAS programs, embedded in web apps and elsewhere

Output Types

Reply
Frequent Contributor
Posts: 97

Output Types

What is the difference between the output types, how and where are they used?

1. Transient Package
2. Permanent Package
3. Streaming
SAS Super FREQ
Posts: 8,868

Re: Output Types

Hi:
1) Transient package -- can be created on either Workspace Server or Stored Process Server. These results are a "package", generally of mixed result types that can come back to a client application for rendering. These results are generally put into a temporary cache location on the client machine and rendered or displayed by the client application.

2) Permanent package -- can be created on either Workspace Server or Stored Process Server. These results are a "package" -- a SAS package file -- that can be written, permanently, to a server file location OR to a webDAV repository (like Xythos).

3) Streaming results -- can only be created on Stored Process Server -- these results are most like the HTTP protocol results that could be returned with the SAS/IntrNet Application Dispatcher program.

For example, you could possibly put a SAS dataset into a permanent package along with a PDF file of a report and possibly an HTML version of the same report. However, in the "streaming" world, you would not send all 3 disparate files down an HTTP pipeline. With streaming results, only one type of content comes down the pipeline at a time -- because of the HTTP request/response model:
user makes a request --> request is fulfilled with streaming HTML results
user makes a second request --> request is fulfilled with a PDF binary file (and the right content-type header for the content)

The Stored Process developer's guide does go into more detail, as do our training classes, on the subject of developing stored processes and stored process result types. Generally, the stored process developer decides on the result type based on what the stored process needs to return. For example, if I had a stored process that was only producing a report -- a tabular report -- I'd pick STREAMING as the result type and execute the SP on the Stored Process server. On the other hand, if I had a stored process that was a tabular report AND a graph, then I'd pick TRANSIENT as the result type and execute the SP on either of the servers -- because the streaming result type isn't appropriate for "mixed" content like a table and an image.

Here are some useful documentation links:
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/index.html
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/result.html
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/stpsamp.html
http://support.sas.com/rnd/itech/doc9/dev_guide/publish/index.html

Keep in mind that if you writing your own custom front end to execute stored processes, then you must consult the documentation for Java or .NET or ... in order to find out how to handle stored process results in those applications that you write.

cynthia
(PS...there is also a result type of NONE -- which would be used for a stored process whose only purpose in executing was to create data files or some non--report--output purpose.)
Frequent Contributor
Posts: 97

Re: Output Types

Posted in reply to Cynthia_sas
Hi Cynthia

Thanks for such a beautiful and educative reply.
Just a small question to know what would you suggest.

1. A report having PROC REPORT code, text file using FILENAME statement, ODS CSV to create CSV. This is actually a scheduled report and will bew viewed in Stored Process Application only for testing purpose.
SAS Super FREQ
Posts: 8,868

Re: Output Types

Hi:
Since this is mixed content (Proc REPORT output, CSV file, TXT file), I'd recommend using TRANSIENT output type -- either the Stored Process Server or Workspace Server will create transient output.

When you submit a Stored Process that returns transient results -- and has multiple output files in the transient package -- when the SP executes using the Stored Process Web Application, the transient package comes back to a temporary internet cache file and what displays on the browser screen is an HTML frame with the different outputs in a navigation area on the left.

When you click on the HTML output, the HTML file shows in the browser. When you click on the CSV output, if the CSV filetype is registered to Excel on your system, then the browser would launch Excel to open the CSV file. If the CSV filetype is NOT registered to Excel, then I think the file will open in the browser, as text. When you click on the TXT file, the file shows in a notepad-ish viewer inside the browser.

(Of course, if your transient package just has one result -- like 1 proc report output -- then you would not see the frame.)

This Tech Support note shows how to insert multiple outputs into one "package" file:
http://support.sas.com/kb/19/824.html

The code below modifies the example code to use PROC REPORT, CSV and DATA _NULL_ only. There is another syntax for sending output to packages using DATA step CALLS. For more information on that method, you would have to read the documentation or consult with Tech Support.

cynthia


*************************** code **********************************
[pre]
/* This stored process creates multiple files and inserts */
/* them in the result package */

/* ** based on this Tech Support note: http://support.sas.com/kb/19/824.html ** */


*ProcessBody;
%let _odsdest = HTML;
%let _odsoptions=file="procreport.html";
%let _odsstyle=egdefault;
%let _odsstylesheet=;

%STPBEGIN;

/* Files in the "&_STPWORK" directory will be copied to the result */
/* package. The &_STPWORK directory is "allocated" when the stored process starts */

/* Insert the first "procreport.html" file using "HTML destination" turned on above */

proc report data=sashelp.class nowd;
title 'Proc Report';
run;

/* Insert "file1_ASCII.txt" file */
filename stpout "&_STPWORK\file1_ASCII.txt";

data _null_;
file stpout;
put "Twas brillig and the slithy toves";
put "Did gyre and gimble in the wabe";
put "All mimsy were the borogroves";
put "And the momeraths outgrabe";
run;

/* Insert the "file2_CSV.csv" file */
ods csv file='file2_CSV.csv' path="&_STPWORK";

proc print data=sashelp.class;
run;

ods csv close;

/* Insert second Proc report "file4_rep.htm" file */

ods msoffice2k file='file4_rep.htm' path="&_STPWORK" style=analysis;

proc report data=sashelp.shoes nowd;
title 'Region Report from Proc Report';
column region sales;
define region /group;
define sales/ sum;
rbreak after / summarize;
run;

ods msoffice2k close;

%STPEND;
[/pre]
Frequent Contributor
Posts: 97

Re: Output Types

Posted in reply to Cynthia_sas
Thanks a lot. Great help.....
Regular Contributor
Posts: 163

Re: Output Types

Posted in reply to Cynthia_sas
Edited by jp 2/08/09. Message was edited by: jplarios
Ask a Question
Discussion stats
  • 5 replies
  • 339 views
  • 0 likes
  • 3 in conversation