Usage Note 23398: In ODS HTML output, can I get only the BY value in the table of contents when generating BY-group information?
The BY-group information is displayed with the label and the variable. To
get rid of this information in SAS 9.1, you can modify the HTML4 tagset and use
the DATA step functions to strip the equal sign from the label. Prior to 9.1, you would have to use some macro code to do this which is shown in the second example. View output.
proc template;
define tagset tagsets.noequal;
parent=tagsets.html4;
define event list_entry;
start:
/* Commented out the below statement so that the byval is a link */
/*break / if cmp(HTMLCLASS,"bycontentfolder"); */
put "<li";
putq " class=" HTMLCLASS;
put ">";
trigger do_link /if listentryanchor;
trigger do_list_value /if ^listentryanchor;
trigger hyperlink finish / if !cmp(htmlclass,"ContentProcName");
finish:
/* Added the below statement so that we add a space only for a new Proc. */
put "<br>" NL / if cmp(htmlclass,"ContentProcName");
put "</li>" NL;
end;
define event hyperlink;
start:
put "<a href=""" URL;
put """";
putq " target=" HREFTARGET;
put ">";
put VALUE / if !cmp(htmlclass,"bycontentfolder");
finish:
put "</a>" NL;
end;
/* Checked the value of the by variable, located the "=" and removed it */
/* using data step function */
define event do_list_value;
eval $list index(reverse(value),"=")-1;
eval $byval reverse(substr(reverse(value),1,$list));
trigger hyperlink / if cmp(htmlclass,"bycontentfolder");
put $byval;
end;
end;
run;
ods tagsets.noequal file='temp.html' contents="temp1.html";
ods proclabel "First output";
proc print data=sashelp.class contents='';
by age;
run;
ods proclabel "Second output";
proc report data=sashelp.class nowd contents='';
by age;
run;
ods proclabel "final output";
proc print data=sashelp.class;
run;
proc univariate data=sashelp.class;
run;
ods tagsets.noequal close;
SAS 8.2
The below SAS 8.2 example creates a separate execution of the
macro and procedure for each BY group and applies a template that removes the unwanted items. Using the macro below, CALL EXECUTE passes the unique
values of the BY group to the macro. The BY groups are subset with the
WHERE= data set option. See also FAQs 3345,
3346, and 3347
for similar information about the GPLOT and GCHART procedures.
View output.
proc template;
define style styles.test;
parent=styles.default;
style contents from contents /
pagebreakhtml=_undef_;
style contenttitle from index;
style contentprocname from indexprocname /
bullet=none;
replace indexitem from container /
listentryanchor=on
bullet=none;
end;
run;
%macro test(val);
ods proclabel ' ';
proc print data=sashelp.class(where=(age=&val))contents="&val";
run;
%mend;
proc sort data=sashelp.class;
by age;
ods html body='body.htm'
contents='cont.htm'
frame='fram.htm'
newfile=proc
style=styles.test;
data _null_;
set sashelp.class;
by age;
if first.age then
call execute('%test('||age||')');
run;
ods html close;
See also the full PROC TEMPLATE FAQ and Concepts.
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | SAS Reference ==> ODS (Output Delivery System) Third Party ==> Output ==> HTML
|
Date Modified: | 2005-06-13 12:47:07 |
Date Created: | 2003-08-19 12:10:11 |