Desktop productivity for business analysts and programmers

Titles For Tables in HTML Output

Reply
N/A
Posts: 0

Titles For Tables in HTML Output

Hi gyes.

I have two queries, and results are displayed in two HTML Outputs.
StoredProcess shows it in one HTML Output, but I need titles for this tables.
So, how to make titles before tables?

Sorry for my English Smiley Happy
SAS Super FREQ
Posts: 8,816

Re: Titles For Tables in HTML Output

Hi:
Normally, to do what you want, you would use the ODS TEXT= statement, as described in these previous forum postings:
http://support.sas.com/forums/thread.jspa?messageID=6151᠇
http://support.sas.com/forums/thread.jspa?messageID=848͐

The way that ODS TEXT= works needs to change a bit for your stored process. In "regular" SAS, you would do this:
[pre]
ods html file='somefile.html' style=sasweb;
ods html text='before proc 1';
proc print data=sashelp.class;
run;

ods html text='before proc 2';
proc freq data=sashelp.shoes;
tables region;
run;
ods html close;
[/pre]

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:

[pre]
%stpbegin;

ods &_odsdest text='before proc 1';
proc print data=sashelp.class;
run;

ods &_odsdest text='before proc 2';
proc freq data=sashelp.shoes;
tables region;
run;

%stpend;
[/pre]

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.

cynthia

PS -- an afterthought -- have you tried just adding a second title statement before your second proc sql???
[pre]
%stpbegin;
title 'first proc sql';
proc sql;
select *
from sashelp.class
where age gt 15;
quit;

title 'second sql';
proc sql;
select *
from sashelp.shoes
where region = 'Asia' and
subsidiary = 'Bangkok';
quit;
%stpend;

[/pre]
N/A
Posts: 0

Re: Titles For Tables in HTML Output

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';
run;
ods html close;

)
But it says that work.table1 not found.
SAS Super FREQ
Posts: 8,816

Re: Titles For Tables in HTML Output

Hmmm, well your problem doesn't seem to be a title statement anymore. It is hard to diagnose why your work table is not found. This may be a question best answered by Tech Support.

cynthia
N/A
Posts: 0

Re: Titles For Tables in HTML Output

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.

Kind regards

David
Ask a Question
Discussion stats
  • 4 replies
  • 123 views
  • 0 likes
  • 2 in conversation