BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
6 REPLIES 6
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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
Cynthia_sas
SAS Super FREQ
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
Vince_SAS
Rhodochrosite | Level 12
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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1968 views
  • 0 likes
  • 3 in conversation