Hi:
There have been previous forum postings on this subject:
http://support.sas.com/forums/thread.jspa?messageID=3244ಬ
http://support.sas.com/forums/thread.jspa?messageID=6632᧨
http://support.sas.com/forums/thread.jspa?messageID=6638᧮
Basically, you will need to make sure that you issue the right content/type header (MIME header) for your content, using the STPSRV_HEADER function in a data null. You also need to make sure you have a working SAS program to convert to a stored process. Usually, you do NOT use or need other ODS statements in your stored process code. So I would recommend removing the statements highlighted below:
[pre]
%stpbegin;
ods listing close; <----may not need this statement
depending on why it is here
ods html; <----delete this statement
%generate_invalid_date;
ods html close; <----delete this statement
%stpend;
[/pre]
That's because %stpbegin/%stpend really take the place of your typical ODS "sandwich" statements. The value for &_ODSDEST is set appropriately by the client application. So, for EG, the SP would return HTML results; for PPT, the SP would return SAS Report XML results.
If you want to control the default output type (which is HTML by default for the IDP), then you would need to do an override to the reserved macro variable &_ODSDEST. If, for example, you wanted to generate a CSV file or an MSOFFICE2k HTML file or a TAGSETS.EXCELXP (Spreadsheet Markup Language XML file), you could override &_ODSDEST for the Portal execution of the SP by doing this BEFORE the %stpbegin:
[pre]
%let _odsdest = msoffice2k;
%stpbegin;
...code...
%stpend;
OR
%let _odsdest = csvall;
%stpbegin;
...code...
%stpend;
OR
%let _odsdest = tagsets.excelxp;
%stpbegin;
...code...
%stpend;
[/pre]
To launch Excel when the results come back to the client browser, you'll still need the correct content/type header using the STPSRV_HEADER function, but this should get you started.
This SGF paper
http://www2.sas.com/proceedings/forum2008/024-2008.pdf
talks about the basics of converting your programs to be stored processes -- it doesn't talk about STPSRV_HEADER, but it does go through the rest of the process. For more help with your stored process, you might consider contacting Tech Support for help.
cynthia