BookmarkSubscribeRSS Feed
mdavidson
Quartz | Level 8
Hello,

I have a stored process that I'd like to stream results back to the user. I'd like to display a few messages to the user, something like:

1) Your process has been submitted.
2) Your query is processing.
3) (display results)

The problem that I'm having is that I can't seem to overwrite the previous _webout file. SAS seems to simply append to the previous _webout file by default. Is there any way to override this?
8 REPLIES 8
webminer
Obsidian | Level 7
Hi,

Not strictly overwriting _webout but ...

Take a look at Don Henderson's excellent blog article and example code here: http://www.sascommunity.org/wiki/Generating_Descriptive_Please_Wait_Messages_for_Long_Running_Stored...

The particular lines that 'switch off' the previous HTML output is here:

%if &pleaseWaitCounter ne %then /* close/hide prior please wait wait message */
%str(ods html text = "";);

I had some problems combining streaming HTML and then switching to Excel output but as long as you are displaying HTML throughout this should give you something to work with.

Hope this helps,

Graham.
Vince_SAS
Rhodochrosite | Level 12
Here is another example:

Usage Note 30889: Displaying the "Please Wait" message for a long-running stored process
http://support.sas.com/kb/30/889.html

Vince DelGobbo
SAS R&D
mdavidson
Quartz | Level 8
Thanks Vince and Graham.

I've got Don's example working -- only one small thing I'd like to change and I'm not sure exactly how to do it. Is there any way to change the style of Don's message? I don't believe I can change the default _ODSSTYLE value since the %STPBEGIN and %STPEND macro variables are turned off, as turning them on would cause a problem with the _WEBOUT file being in use.
webminer
Obsidian | Level 7
Hi,

I got the style to change as follows:

Turn OFF the automatic generation of Stored Process Macros: (on the SAS Code/"Include Code for" button while editing the Stored Process in EG.)

Code the %stpbegin/end yourself:

%global _odsstyle;

%let _odsstyle = seaside;

%stpbegin;

%PleaseWaitExample;

%stpend;

It's a bit fiddly but it works. Another option is to rewrite the PleaseWait code with data _null_ and put statements and use a homegrown .css file.

Email me at graham.murray@webminer.co.uk if you want me to send you the code I have.

HTH,
Graham.
NN
Quartz | Level 8 NN
Quartz | Level 8

Hi guys,

I was facing  a similar problem as said by graham above.

I have a summary proc report which is generated first and needs to be displayed to the User.

Then a CSV file containing additional data points needs to be generated where the user will be prompeted to save the file in his desktop.

The problem is that along with the proc report the contents of the CSV are also appearing in the same HTML and a separate prompt for downloading the CSV is not getting generated.

If any one has found a workaround for this then would request you help.

Thanks

webminer
Obsidian | Level 7

Hi

If you haven't managed to fix this drop me a line offline (email above...).  I'm not working with the stored process server at my current client (yet) but could maybe point you in the right direction if I could see the code.

IIRC, I did something similar to your scenario by separating into 2 stored procs ... First stored proc runs the proc report and then used Don's macro to display a 'Continue' button after the proc report html. (The html in the button runs the second stored process which streams the CSV file ...)

HTH,

Graham.

AngelaHall
SAS Employee

I've written a blog post about this as well.

http://blogs.sas.com/content/bi/2010/07/20/combining-graphsprocs-with-custom-html-in-a-sas-stored-pr...

You can simply add the STYLE macro inside the ODS HTML statement as follows:

ods html body=_webout (no_bottom_matter) style=sasweb path=&_tmpcat  (url=&_replay);

~ Angela Hall

NN
Quartz | Level 8 NN
Quartz | Level 8

Hi,

Angela what you have given is helpful but i dont think it would work in my scenario.

Graham,

Your idea of executing the process again will work but i wish to refrain from doing that.

A sample code that i was aiming at is as below. in my Stored process i have closed the auto generated stored process macros.

*HTML PART START;
ods html body=_webout;

proc print data=sashelp.class;
run;
ods html close;
*HTML PART END;

*CSV PART START;
data _null_;

   /* Set HTTP headers */
    rc = stpsrv_header('Content-type','application/vnd.ms-excel');
 
   /* Prompt to SAVE or OPEN the attachment file named test.xls using Excel */
    rc = stpsrv_header('Content-disposition','attachment; filename=test.csv');
   run;
 

  data _null_;
  file _WEBOUT;
    do UNTIL (EOF);
    set sashelp.class end=eof;
  put @01 name $12.
        @17 sex $11.
           ;
  END;
  run;

*CSV PART END;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 12708 views
  • 0 likes
  • 5 in conversation