02-27-2017 03:47 AM
These days i've been validating a macro which we use in the SAS-Web-application to publish a result-package (result.zip) to the clients e-mail adress, with a STP. In a nutshell it retrieves the e-mail adress of the client, takes everything out of a special result folder, zip's it and publishes the package with a few notes in the e-mail to the client.
I wrote the following minimalistic STP code to validate the macro (represented by Test2).
FILENAME mylog "E:\SAS_DATA\0_storedprocesses\dev\MacroVal\v3\2_log\stp_output_to_client_test_v3.log"; PROC PRINTTO LOG = mylog NEW; RUN; %INCLUDE "E:\SAS_DATA\2_macros\dev\v3\1_pgm\stp_output_to_client_v3.sas"; %INCLUDE "E:\SAS_DATA\2_macros\dev\v3\1_pgm\stp_output_to_client.sas"; %LET task_root = E:\SAS_DATA\0_storedprocesses\dev\MacroVal\v3\; %LET res_path = E:\SAS_DATA\0_storedprocesses\dev\MacroVal\v3\6_output\; %LET MailAddress = Clients_email_address@xy.com; %LET stp_run = 0; %LET refresh = 0; %LET web_application = 1; %LET logstatus = PASS; /*Test2*/ /*%stp_output_to_client([...]Parameters used); */ PROC PRINTTO; RUN;
Defaultly i activated the result capabilities Stream and Package (because we do both in normal STP's).
When executing the STP in our Web-application i got following error message:
Stored Process Error The SAS program did not produce any output.
That makes sense, because i don't have a %stp_begin and %stp_end in my STP, which is for my understanding the implemented standard-way to stream a result. When i just click the Result capability Package, i get following erorr:
Eventough i create a package, and publish it via e-mail to my client (and it works). So finally my Qestion is:
1. Why do i get this error message?
2. Is there a standard-SAS-method to create packages and publish them per e-mail?
Thank you in advance,
02-27-2017 04:32 AM
A STP for a web application needs to create at least some stream output, as the STP web interface expects this. If no stream is sent, you get your first error message.
Your STP should send some stream output like "The operation was successful".
If you only want package output, you have to use the %stp_begin and %stp_end macros, as they set up the expected package output.
My preferred method for publishing would be
- don't use %stp_begin and %stp_end
- don't create a package; de-select package output
- create tables and/or HTML output on the server; HTML in a subdirectory where the web server has access (DocumentRoot and subdirs). "HTML" here also means downloadable content (text, csv, etc)
- send email from SAS (filename mail) to the recipients with a message that content has been created; include links to that content.
- satisfy streaming output by writing a success (or non-success) message to _webout (use HTML code).
Keeping results out of the email prevents problems caused by emails grwoing larger than mail servers tolerate.