The way that ODS TEXT= works needs to change a bit for your stored process. In "regular" SAS, you would do this:
ods html file='somefile.html' style=sasweb;
ods html text='before proc 1';
proc print data=sashelp.class;
ods html text='before proc 2';
proc freq data=sashelp.shoes;
ods html close;
However, when you turn that program into a stored process, each client application could possibly set %stpbegin for a different destination for returning results. For example, in Microsoft Word, the user could change the result type from a stored process to be: SASReport, HTML or RTF -- you need your ODS TEXT= statement to work for ANY destination the users pick. So, when you convert the above program to be a stored process, you would have to use &_ODSDEST instead of HTML for the TEXT= statement:
Also, keep in mind that some client applications may not make use of the ODS TEXT= string -- so a good idea would be to test your stored process on all client applications from which it might be submitted. In order to add the ODS &_ODSDEST TEXT= statement, you will have to edit the stored process code by selecting OPEN from the SAS Folder list and then editing the code. If you do not have sufficient authorization to edit or change stored process code, then you will have to get an administrator help you make the change.
PS -- an afterthought -- have you tried just adding a second title statement before your second proc sql???
title 'first proc sql';
where age gt 15;
title 'second sql';
where region = 'Asia' and
subsidiary = 'Bangkok';
I have done like this, but I had a problem.
Just take a look on this: Query -> Table, generated by this query(work.table1) -> Code ( ods html file='filename.html';
proc print data=table1;
title 'My Title';
ods html close;
But it says that work.table1 not found.
I have no idea where the name of the data set TABLE1 comes from, but if you use the GUI to analyse a permanent data set, Enterprise Guide creates a copy of the table in the work library and uses that for analysis.
Then it executes a macro ca;lled _SASTASK_DROPDS to clean up after itself.
If TABLE1 was created by an analysis or descriptive process, then it will have deleted the table copy when the task was complete and you won't be able to print or describe the data.