Usage Note 23324: How can I add an ALT= parameter to images created with SAS/GRAPH software?
To add the ALT= parameter to images generated with SAS/GRAPH software, use the experimental ODS MARKUP Language. There are quite a few ways to do this.
Using the the CHTML tagset, the default is to generate
a GIF file with the default value of the ALT= parameter,
which is "graph image". You can use PROC TEMPLATE to modify the value generated with the CHTML tagset. The CHTML tagset does not allow the use of styles. CHTML is the abbreviation for compact HTML and it produces very small files.
/* Sample Markup code that generates a graphics */
/* file with the ALT= parameter. */
ods markup file="c:\temp.html" tagset=CHTML;
goptions device=gif;
proc chart data=sashelp.class;
vbar height;
run;
quit;
ods markup close;
/* Sample code that modifies the ALT= parameter */
proc template;
define tagset tagsets.test;
parent=tagsets.chtml;
define event image;
put "<img";
put " alt=""A new graph image""";
putq " src=" URL ">" NL;
end;
run;
ods markup file='c:\temp.html' tagset=tagsets.test;
goptions device=gif;
proc chart data=sashelp.class;
vbar height;
run;
quit;
ods markup close;
To create the ALT= parameter with an image and include styles, use either the HTMLCSS or the PHTML tagsets. Below is PROC TEMPLATE code to add the ALT= parameter to the image.
/* Generate file with the ALT= parameter and allow */
/* styles */
ods markup file='temp2.html' tagset=tagsets.new
stylesheet='temp.css';
goptions device=gif;
proc gchart data=sashelp.class;
vbar height;
run;
quit;
ods markup close;
/* Modify the ALT= parameter and including styles. */
ods path sasuser.templat(update) sashelp.tmplmst(read);
proc template;
define tagset tagsets.new;
parent=tagsets.htmlcss;
define event image;
put "<img";
put " alt=""I really like this graph""";
putq " src=" URL;
put ">" NL;
end;
end;
run;
ods markup file='temp2.html' tagset=tagsets.new
stylesheet='temp.css';
goptions device=gif;
proc gchart data=sashelp.class;
vbar height;
run;
quit;
ods markup 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: | Query and Reporting ==> Creating Reports ==> Graphical SAS Reference ==> ODS (Output Delivery System)
|
| Date Modified: | 2004-09-10 16:27:07 |
| Date Created: | 2003-08-07 15:10:45 |