Data visualization with SAS programming

save html report with graphs

Reply
Occasional Contributor
Posts: 18

save html report with graphs

I need an instruction how to save html report from results. All posts i have read didnt helped. If I export then I get html only with table but no graphs in it. If I use:

ods html path = ""
gpath = "" (url="png/")
file = ".html"
;

Or 

 

filename grafout '';

goptions reset=all device=png
gsfname=grafout gsfmode=replace;

goptions reset=goptions device=png;

ods listing close;

 

Or 


ods html path='' (url=none) file='sastest.html';

ods html body='drug1.htm' newfile=page style=HTMLBlue;

 

I get nothing but errors.

Super User
Posts: 9,611

Re: save html report with graphs

Posted in reply to ManOfHonor

If you need help with an error, you have to show it. So post the log(s) from your failed steps.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 18

Re: save html report with graphs

Posted in reply to KurtBremser

I have a directory servers\SASApp\Files\Validation

I know its impossible to write on local drive (on Windows),

so i decided to write to SAS server instead.

 

22 GOPTIONS ACCESSIBLE;
23 ods html path = "Files/Validation"
24 gpath = "Files/Validation/png" (url="png/")
25 file = "filename.html"
26 ;
NOTE: Writing HTML Body file: filename.html
ERROR: Physical file does not exist, /sas/config/Lev1/SASApp/Files/Validation/filename.html.
ERROR: No body file. HTML output will not be created.

 

What does it mean  "does not exist"? Yes, I want sas to create file.

Super User
Posts: 9,611

Re: save html report with graphs

Posted in reply to ManOfHonor

There are two ways to specify a path on any UNIX system:

  • relative; the path does not start witha forward slash; this means that the system will prepend this path with the current working directory, which is /sas/config/Lev1/SASApp, the location from which the SAS process was started
  • absolute: the path starts with a forward slash, instructing the system to search from the root directory

So if you know there is a directory Files/Validation in the root of the UNIX system, use /Files/Validation to access it.

Further, be aware that UNIX is case sensitive throughout, so you can have Validation and validation in the same place specifying two different objects. Most (all) UNIX admins that I know prefer to only use lowercase letters in path names, for ease of typing and keeping the sort order (since "Z" comes before "a" in the ASCII sequence). Capitals are used for special purposes only (eg a README file that will always show up first in a directory listing)

 

Your error message means that the path does not exist, you also do not have the necessary permissions to create it, the file could therefore not be created, and when SAS tried to write to it, it did not exist.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 18

Re: save html report with graphs

Posted in reply to KurtBremser

I cant figure this out, for sure.

Then, How to export html from results containing all graphs? All I get are just tables.

Occasional Contributor
Posts: 18

Re: save html report with graphs

Posted in reply to ManOfHonor

The problem halfway solved:

Tools-> Options -> results (results general) tick the box "html",

however some labels, graphs and legend I get are  a bit  distorted 

SAS Employee
Posts: 1,031

Re: save html report with graphs

Posted in reply to ManOfHonor

Are you using Enterprise Guide?

Super User
Posts: 9,611

Re: save html report with graphs

Posted in reply to ManOfHonor

When starting your ods output, specify all necessary physical and logical paths:

ods html file=outfile1
  path="&outpath./"
    (url="http://XXX/~%sysget(USER)/&urlpath./")
  gpath="&outpath./&graphbase./"
    (url="http://XXX/~%sysget(USER)/&urlpath./&graphbase./")
;

In this example (taken from one of our batchjobs), path and gpath contain the physical file/path names where the files are written, while the url= options name the logical paths that are written into the files when creating the links to sub-pages and graphics. This makes sure that all graphics show up correctly when the main page is accessed by browser.

So imagine we want to create a HTML report called myreport, and the job is run by user itsme on server xxx.com:

%let outpath=$HOME/public_html/myreport;
%let graphbase=graphics;
%let urlpath=myreport;

filename outfile1 "&outpath./myreport.html";

/* ods statement with resolved values */

ods html file="/home/itsme/public_html/myreport/myreport.html"
  path="/home/itsme/public_html/myreport/"
    (url="http://xxx.com/~itsme/myreport/")
  gpath="/home/itsme/public_html/myreport/graphics/"
    (url="http://xxx.com/~itsme/myreport/graphics/")
;

When you now access http://xxx.com/~itsme/myreport/myreport.html, all graphics will appear nicely, and links to sub-pages (eg from proc report) will also work.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 7 replies
  • 168 views
  • 0 likes
  • 3 in conversation