Your SAS programs, embedded in web apps and elsewhere

how to set the title for a html page created through a stored process?

Reply
N/A
Posts: 0

how to set the title for a html page created through a stored process?

Hi,

does anyone know how I can specify the title to be displayed in the browsers title bar, when using the %stpbegin and %stpend macros in a stored process?

In plain SAS I would use e.g.

ods html body='c:\temp\class.html'(title='Students');
proc print data=sashelp.class;
run;
ods html close;

to set 'Students' as the browser title. For the stp generated pages I always get 'SAS Output'.

Thanks,
Frank
SAS Super FREQ
Posts: 8,864

Re: how to set the title for a html page created through a stored process?

Posted in reply to deleted_user
Remember that not all client applications are receiving the stored process results in a browser. So the title= suboption will NOT work in all the client applications.

I do not actually know whether title= works in the Stored Process Web Application or the Information Delivery Portal. I would NOT expect TITLE= to work in Web Report Studio or the SAS Add-in for Microsoft Office. It MAY work in EG, depending on how you write your stored process.

So, for example, when I wrote this as a stored process:
[pre]
%let odsoptions=(title="My Report");

%stpbegin;
proc print data=sashelp.class;
title 'The SAS Title';
run;
%stpend;
[/pre]

As long as the client application returned HTML results (such as in EG), the title was used (I had to open the output in a separate IE window to see the title). But, when I executed this stored process using the SAS Add-in for Microsoft Office (Word), the stored process failed because TITLE= is not a valid option when used within the context of the Add-in.

cynthia
N/A
Posts: 0

Re: how to set the title for a html page created through a stored process?

Posted in reply to Cynthia_sas
sorry, I forgot to mention that I'm using the SASStoredProcess web application.
Anyway, your suggestion doesn't work for me.
According to the documentation at http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/reserved.html I changed your example to

%let _odsoptions=(title="My Report");
%stpbegin;
proc print data=sashelp.class;
title 'The SAS Title';
run;
%put _all_;
%stpend;

but it failes with

3 +%let _odsoptions=(title="My Report");
4 +%stpbegin;
ERROR 22-322: Syntax error, expecting one of the following: ;, ANCHOR, ARCHIVE, ATTRIBUTES, BASE, BODY, CHARSET, CLOSE, CODE, CONTENTS, CSS, ENCODING, FILE, FRAME, GFOOTNOTE, GPATH, GTITLE,
HEADTEXT, METATEXT, NEWFILE, NOGFOOTNOTE, NOGTITLE, PAGE, PARAMETERS, PATH, RECORD_SEPARATOR, STYLE, STYLESHEET, TEXT, TRANTAB.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
4 (title="My Report")
_
22
_____
202
5 +proc print data=sashelp.class;
6 + title 'The SAS Title';
7 +run;

I guess this happens, because title is not an independent option but a sub-option of the body option - is this correct?

Thanks,
Frank
SAS Super FREQ
Posts: 8,864

Re: how to set the title for a html page created through a stored process?

Posted in reply to deleted_user
OK...well as long as you're using the Stored Process Web Application, then try this:
[pre]
ods html file=_webout(title="My Report2");
proc print data=sashelp.class;
title 'The SAS Title';
run;
ods html close;
[/pre]

But remember that using this form of writing the stored process may limit you to where (what client applications) your stored process can be executed from.

cynthia
N/A
Posts: 0

Re: how to set the title for a html page created through a stored process?

Posted in reply to Cynthia_sas
thanks, Cynthia, but due to the implications you mention, I'm not going to follow this route.
I just wished there was something as simple as a _ODSTITLE macro variable, which would be honored by the %stpbegin macro.

-Frank
SAS Super FREQ
Posts: 8,864

Re: how to set the title for a html page created through a stored process?

Posted in reply to deleted_user
I know what you mean. But, sadly, I think that it's not possible. The client applications are SO flexible -- in letting the end-user select how the results should be returned -- HTML, RTF, SASReport XML, CSV, etc -- and (TITLE=) is just not appropriate for all destinations. It would require a boatload more conditional logic in %stpbegin to ignore the (TITLE=) for destinations where it was not appropriate.

cynthia
SAS Super FREQ
Posts: 304

Re: how to set the title for a html page created through a stored process?

Posted in reply to Cynthia_sas
Usage Note 38254: How to use the ODS TITLE option with the %STPBEGIN macro
http://support.sas.com/kb/38/254.html

As Cynthia said, this will fail for some destinations.

Vince DelGobbo
SAS R&D
Ask a Question
Discussion stats
  • 6 replies
  • 299 views
  • 0 likes
  • 3 in conversation