Graphic files and the gpath and path options
The
gpath
option of the
ods html
statement controls where the
graphic files are created.
If gpath
is not specified, the graphic files will be created in the same directory as specified with the path=
option.
If file=
is not specified as well, the graphic files will be created in the default directory.
Graphics and option url
If after creation of the html and graphics, the generated html file is moved to a different location, the option url
must be set to none
.
The following example does not explictely specify a graphic destination path with gpath
. The graphic will be created in the same directory as the html file.
In order to be able to move the created files around, url=none
is used:
ods listing close;
ods html path='/share/home/tq84/sas/ods/html' (url=none)
body='gchart.html';
goptions reset=all;
proc gchart data=sashelp.class;
hbar age / discrete
name="graph" /* Names the created graphic (without suffix) -> graph.png will be created */
;
run;
quit;
/* Since we specified url=none, the image will be referenced
without a path:
<img … src="graph.png" …>
*/
ods html close;
ods listing;
This example uses the gpath
option to specify a graphic path. The url=
option is used to accomodate for the different path:
ods listing close;
ods html path='/share/home/tq84/sas/ods/html'
gpath='/share/home/tq84/sas/ods/html/img' (url='img/') /* url specifies the relative path of the created graphic */
body='gchart2.html';
goptions reset=all;
proc gchart data=sashelp.class;
hbar age / discrete
name="graph2" /* Names graphic without suffix -> img/graph2.png will be created */
;
run;
quit;
/* Since we specified url=img/, the image will be referenced
with a prefixing it by that url:
<img … src="img/graph2.png" …>
*/
ods html close;
ods listing;
proc sql
data tq84_numbers_1_to_10;
length num 4. txt $20;
do num = 1 to 10;
txt = put(num, words20.);
output;
end;
run;
ods listing close;
ods html
body = 'tq84_body.html'
contents = 'tq84_contents.html'
page = 'tq84_page.html'
frame = 'tq84_frame.html'
/*
path: destination for created files.
Use url=none in order to not have absolute paths
within links in the created html files. */
path = "&tq84_ods_test_linux_dest_path" (url=none)
;
ods proclabel 'Just the data';
proc print data = tq84_numbers_1_to_10;
title "Numbers from one to ten!";
quit;
ods proclabel 'Selecting odd numbers with proc sql';
proc sql;
title "Odd numbers.";
select * from tq84_numbers_1_to_10
where
mod(num, 2) = 1;
quit;
ods html close;
ods listing;