BookmarkSubscribeRSS Feed
Calcite | Level 5


Hello Experts,


I have a stored process which when executed from Information Delivery Portal, generates a report in simple tabular form, which can be downloaded in Excel. I am looking for a solution to migrate this stored process to Visual Analytics from where the report should be first displayed in report viewer and then it should allow to download / export in MS Excel format, just like a list table report can be downloaded in Excel. 





Rhodochrosite | Level 12


If you really need to create data dynamically instead of having it in a data mart you can use "Job execution" to create a table "on-the-fly" and then use that table in your  VA-report. 


This link may help you to get a start:



Calcite | Level 5


Hi Fredrik,


Thanks for your reply. The report will have more than 100,000 rows. If this report is designed and generated in VA, the export will result in partial download. Therefore I am looking for a solution to export stored process report in VA. Looking at the sample stored process in VA, I observed that reports are only displayed and there is no facility to download / export these reports.



Thanks much. 

Rhodochrosite | Level 12


Ok, wouldn't it be better if you ran the stored process directly from Excel via the SAS add-in?


Calcite | Level 5




There would be around 500+ reports and thousands of users accessing the reports. Therefore a single URL is convenient here. 



Thanks much.


SAS Employee

I think this can be done.  It is easiest to create 3 stored processes.  One to generate the form that is initially displayed.  Another to run the report to send results back to the viewer.  Another to run a stp that exports it to ODS.


STP 1 would look similar to the following:



     file _webout;

     put "<html>";

     put "<style>";

     put "body {font-family: 'Calibri';}";

     put "h3 {text-align: center;}";

     put "div {font-size: small; font-weight: bold;}";

     put "</style>";

     put "<body>";

/* first form to run stored process to "return to start" */

     put "<FORM ACTION='&_URL'>";

      put '<input type="hidden" name="_program"  value="/Projects/TLM/StoredProcess/TLM_DnM_FC_get_input">';

         put '<div><input type="submit" value="RETURN TO START"></div></form>';

/* end of first form definition */

           put '<br>  </br>';

/* second form to run stored process that will export to excel */

       put "<FORM ACTION='&_URL'>";

           put '<input type="hidden" name="_program" value="/Projects/TLM/StoredProcess/TLM_DnM_export2Excel">';

           put '<div><input type="submit" value="EXPORT TO EXCEL"></div></form>';

/* end of second form definition */

     put "</body>";

     put "</html>";


/* ********************************************************************************************************** */


STP 2 would be the stp that you have already created making sure that it is wrapped with %stpbeing and %stpend


STP 3 would be your same code in STP 2, but you would use tags to Export to Excel like the following example:


The next step that you must have in place is to define the stored process TLM_DnM_export2Excel, and here is a short example of code that exports a PROC PRINT output to Excel.  This stored process must be registered to execute on the "Stored Process Server only" and should produce Stream results.


/*  Example: Create a HTML file for downloading to Excel. */

/*             Using %STPBEGIN and %STPEND                  */




data _null_;

   rc = stpsrv_header('Content-type','application/');

   rc = stpsrv_header('Content-disposition','attachment; filename=report.xls');





proc print data=sashelp.class;




Calcite | Level 5



Thanks for your reply. I will certainly check this. My stored processes have one or more prompts. Do stored process prompts work in VA? I tried with sample stored process. In report designer, it allows to edit prompt values. But in report viewer, prompts are not shown and the stored process report gets executed with edited prompt values in designer. Prompts are very much important functionality in my sp reports.



Thanks much. 

Calcite | Level 5

Hi Keith and Fredrik,


All that I wanted was to migrate stored processes with prompts to VA. Just found that SAS VA 7.3 onward do not support entering prompt values and those values can be saved in designer, which is of no use. It is explained on this SAS support page:


But then this tip to run a stored process with full prompt functionality from a SAS Visual Analytics report is misleading:


Providing a link to stored process from VA report using text object is not a solution to  run a stored process with full prompt functionality from a SAS Visual Analytics report.


The outcome is VA 7.3 onward do not support full functionality of stored process and further the report generated by stored process object can not be exported like list table object.


SO I think the subject is closed now. 


Thank you very much.

Obsidian | Level 7

This seems very close to the answer i need to my problem.  The only missing piece is, what if the table you need to output is a work table?  Wouldn't the STP3 not see that table?

Rhodochrosite | Level 12

You can solve that using sessions.

You can save a table to the session and pick it upp from any other program using the session ID 🙂



Obsidian | Level 7

This sounds like it's exactly what I need! Thank you!



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 1 like
  • 4 in conversation