BookmarkSubscribeRSS Feed
Felix_
Obsidian | Level 7

Dear Community,

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).

 

stp_result_capabilities_2.png

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:

error_result_package.PNG

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,

Felix

1 REPLY 1
Kurt_Bremser
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1184 views
  • 0 likes
  • 2 in conversation