BookmarkSubscribeRSS Feed
ManOfHonor
Obsidian | Level 7

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.

7 REPLIES 7
ManOfHonor
Obsidian | Level 7

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.

Kurt_Bremser
Super User

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.

ManOfHonor
Obsidian | Level 7

I cant figure this out, for sure.

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

ManOfHonor
Obsidian | Level 7

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 

GraphGuy
Meteorite | Level 14

Are you using Enterprise Guide?

Kurt_Bremser
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1532 views
  • 0 likes
  • 3 in conversation