When it comes to talk about optimization and user-experience, philosophy and science meet in a gray area of mistery where time relativity becomes a major issue, a contradiction in terms which is usually called "the Interphone Paradox":
-Bzz... Hello my love... Bzzz... I'm downstairs, are you coming?
-Bzz... Yeah, I'll be there in a minute.
Philosophers usually explain that with the legend of the wise janitor. Once upon a time in Naples there was a lawyer company. They had an issue: the lift was too slow and little. Replacing the old lazy lift with a modern one was far too complicated and expensive, and employees were suffering. In a situation where science could not help, the wise janitor came with the right solution: let's put a mirror next to the lift entrance. Employees were pushing the lift button, then looking at the mirror, checking if the makeup was ok, tightening their ties, making sure the hickey they got the night before in the disco was not that evident and such. And it was like magic: they pushed the button and it was like the lift was taking no time to arrive.
Information technologies call it "progress bar", "loading wheel", "porn animated gif", that is some graphical trick telling the user "no, seriously: I'm really doing something...", rising the user expectations and making him confident that something good is about to happen.
Taking it down to SAS Visual Analytics and Stored Processes, the problem is about the STP execution flow: when entering the report, the STP is launched and an empty frame is displayed until execution is completed. No way to put a porn animated gif in it. Take this you wise stinky janitor! So, what if your STP is expected to take a lot of time to execute? A nice solution might be using two STPs instead of one (would you have ever had thought of it my poor janitor? MHUAHAUHAUHAUHAUHAUAHAUHAUHAUAHUAHUAHAUHAUHAUHA).
First thing you have to do is about creating a "Launcher" STP, containing just the loading wheel and a hidden iframe pointing the "Core" STP. Then, you add a javascript callback on the iframe loading completion event, hiding the wheel and showing the iframe. This way the flow is completely asynchronous: the launcher STP is shown immediately, for it takes almost no time to load the gif. The core STP has no relation with the rest of the GUI, so Visual Analytics won't bother making you waiting, and the launcher is the only responsible for the output to be displayed.
How do I execute the core STP? You just need to have your iframe src referencing the SAS Stored Process Web Application, which is usually bundled with the SAS Web infrastructure Platform you get with Visual Analytics.
How do I pass prompt parameters from the launcher STP to the core STP? Simply by passing the core stp the same query string as the one for the launcher (except the _program parameter, that is the STP to be executed).
How do I accept being smarter than the janitor? There is no way: you are just far too cool, that's all.
data _null_;
file _webout;
[...]
put '$(document).ready(function() {';
put 'var queryString = window.location.href.substring(window.location.href.indexOf("?"));';
put 'queryString = queryString.replace("STPLauncher","STPCore");';
put 'var ifr=$("<iframe/>", {';
put 'src:"http://<host>/SASStoredProcess/do"+queryString,';
put 'style:"display:none",';
put 'load:function(){';
put '$("#waitingDiv").addClass("hidingClass");';
put '$(this).show();';
put '}';
put '});';
put '$("body").append(ifr);';
put '});';
[...]
run;