Usage Note 24302: Can I remove the equal sign from the BY value in the table of contents for ODS output?
The variable name and the equal sign can be removed from the BY-value line in the HTML table of contents by using a customized tagset along with the ODS MARKUP destination. The MARKUP destination gives you access to each piece of HTML output. With PROC TEMPLATE logic, you can substring the variable name and the equal sign values from the BY value using DATA step functions.
The sample code on the Full Code tab is applicable to SAS® 9.2 and higher. If you are running SAS® 9.1, use the sample code from the Downloads tab.
This functionality can also be accomplished with the ODS DOCUMENT destination and PROC DOCUMENT if a similar change is desired in other destinations.
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.
The code below generates a customized tagset named NOEQUAL using PROC TEMPLATE. This tagset edits the BY line from BYVARIABLE=VALUE to VALUE. It also removes the second node for each procedure so that only the first level node and BY variables' values are listed.
Note: The HTMLBLUE style is new for SAS 9.3.
ods path work.templat(update) sashelp.tmplmst(read);
proc template;
define tagset tagsets.noequal;
parent=tagsets.html4;
define event list_entry;
break / if cmp(htmlclass,"contentitem");
start: 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: put split NL / if cmp(htmlclass,"ContentProcName");
put "</li>" NL;
end;
define event do_value;
trigger do_header_dots;
eval $byval VALUE;
eval $eq countw(VALUE,"=");
eval $eq1 $eq+1;
eval $w 2;
do / while $w <= $eq;
eval $temp scan(VALUE,$w,"=");
do / if $w < $eq;
eval $l1 length($temp);
eval $l2 index(reverse($temp)," ");
eval $l3 $l1-$l2;
eval $temp substr($temp,1,$l3);
done;
do / if $w = 2;
eval $temp2 $temp;
else;
eval $temp2 catx("/",$temp2,$temp);
done;
eval $byval $temp2;
eval $w $w+1;
done;
put VALUE / if !cmp(dest_file,"contents");
put $byval / if cmp(htmlclass,"bycontentfolder") or cmp(htmlclass,"contentitem");
end;
end;
run;
proc sort data=sashelp.cars out=test;
by origin;
run;
ods tagsets.noequal file="file.html" contents="contents.html"(title="Created with SAS &sysver") path="c:\temp" style=htmlblue;
ods proclabel="First";
proc print data=test noobs;
by origin ;
run;
ods proclabel="Second";
proc sgplot data=test;
by origin ;
vbar cylinders;
run;
ods _all_ close;
Type: | Usage Note |
Priority: | low |
Topic: | Third Party ==> Output ==> HTML SAS Reference ==> ODS (Output Delivery System)
|
Date Modified: | 2005-07-01 17:14:43 |
Date Created: | 2005-06-17 16:11:00 |