BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PoulRavn
Obsidian | Level 7

Hi, I use EG61 in a Windows environment (local machine Win7, EG61, server SAS 9.3).

I have never really got t good start on using ODS, but now I need to create a standard set of graphs that should be viewable from a browser. I used to have Base SAS on my onw PC, and from that I used the intermediate scheme (many years ago) of the 'webframe' device, which was enough for what I wanted to do. However have now 'migrated' to EG 61 I find this not to work anymore.

Basically I have several problems:

1) I do not really understand what ODS is? Is it a procedure or what? Once you use ODS you should not use proc gplot/proc chart etc. anymore but rather sgplot. Why? The notation is different and it is a uncertain learning path.

2) I do not quite understand the principle of 'open' and 'close' when using ODS. Why is this necessary?

3) What about control of where ODS via EG puts the html files? I want to create simple webpages that allow people to browse quickly through a set of graphs, dashboard style. Basically I want a TOC with clickable links and then the graphs on the right hand side of the panel. The examples I can find all look much more complicated and introduces concept I do not see I need.

4) There is a styles catalogue that contains the styles? Can I access it and modify it? And how? I want to change the size of a graph and also the split of the TOC and the graphics pane.

All in all, a little bit frustrated, - as always when new (to me) concepts have to be learned.

Any help and hints greatly approciated.

Thanks

Poul

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi, there isn't a "graphics on" statement. If the OP is using SAS/GRAPH procedures, then he needs to use the GOPTIONS statement and if the OP is using ODS GRAPHICS, then he needs to use the ODS GRAPHICS statement, not the "GRAPHICS" statement.

  Generally, when you are trying to control ODS output, especially ODS HTML output that creates graphs, you have to understand that HTML requires an <IMG> tag to point to the location of the image. So, generally instead of BASE=, which refers to the "base" url that should be used after the page  is created and when the page is on a web server. I prefer to use other options instead of BASE= (which usually requires that I know the naming convention on my web server -- which I don't) and instead, I use

ods html path='c:\temp' (url=none)

             gpath='c:\temp' (url=none)

             file='main.html'

             contents='toc.html'

             frame='frame.html';

*** code;

ods html close;

Then, this program will make ALL the HTML files and ALL the graph images in the C:\temp directory folder (otherwise, it makes the HTML file in one folder and usually makes the graphic image file in another folder). This also builds an <IMG> tag that has "relative" URL locations for the graphic images. So, this means that if you move ALL the HTML files and ALL the image files into the same directory on the web server, then when you open the FRAME.HTML file, it will contain all the correct links to load the frame navigation files and to load the image files into the display area of the web page.

As to whether you should use SAS/GRAPH or ODS GRAPHICS, that is totally up to you. SAS/GRAPH is great and gives you pixel by pixel control of your output. In some examples ODS GRAPHICS is easier and requires less annotation and less GREPLAY than older SAS/GRAPH programs. But if you have SAS/GRAPH programs, they will still work, as long as you have SAS/GRAPH licensed.

Here's some reading about the differences: https://support.sas.com/resources/papers/proceedings12/261-2012.pdf and https://support.sas.com/resources/papers/proceedings11/294-2011.pdf.

cynthia

View solution in original post

11 REPLIES 11
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Wow, lots of questions Smiley Wink  Firstly I suggest reading the manual as that has all the information.  ODS (Output Delivery System)

I will summarise a couple of points here:

1) ODS is the output delivery system.  It is a large system designed to combine styles, data, structures etc. into one or more files of a defined type{s}.  There is no reason why you cannot use gplot/gchart with ods, all output from all procedures can now be directed to ODS.  However I would suggest dropping gchart/gplot and using either sgplot (simplified version of) or Graph Template Language.  These are the new incarnations and they are more powerful and controllable than the old systems.

2) As ODS is a destination, that destination needs to be opened and closed, much like a file.

3) I think you will find it is a big topic this.  You may be better off looking at software specifically designed for the task, SAS Web Report Studio, JReview etc.

4) Styles is another big area.  Read the manual.  Proc template is used to define styles, you can either inherit or create as new.  As for how to access it, well in Base SAS I goto Results and right click and select templates.  Not sure in EG as haven't used in a while.

Kurt_Bremser
Super User

For what you want, you will need the ODS HTML destination.

You start output with the ODS HTML statement. Look up this statement first, as it provides most of what you need to define (filename of the html file.

Take note of the body=, contents=, path= and gpath= options with their (url=) suboptions.

The examples inlcuded here:

SAS(R) 9.2 Output Delivery System: User's Guide

will provide most of what you need to know to get started.

PoulRavn
Obsidian | Level 7

Hi,

I looked several times at the manual as suggested. To give you an idea of what kinds of trouble I see, when I try such things as examples from the manual, consider the 'grain' example on this page:

SAS(R) 9.2 Output Delivery System: User's Guide

I copied it to the program editor and changed this section of the program (only the line that specifies the base location):

html body='grain-body.htm'

contents='grain-contents.htm'

frame='grain-frame.htm'

page='grain-page.htm'

base='\\myserver\mytopfolder\myspecificfolder'

newfile=page;

I assume this puts the htm files at the location specified, but it doesn't. Rather it puts them on the E:-drive of the server, that runs SAS 9.3.

The log says

ERROR: Invalid file, \\myserver\mytopfolder\. . . . .

ERROR: No body file. HTML output will not be created.

which is not really helpful.

I believe that everything I can do with ODS is great, once I get it to work as expected.

Thanks

Poul

Kurt_Bremser
Super User

On that same page, you find links to the documentation of all the options for the ODS HTML statement. There you find that base= names the base url for all references within the HTML you create (which browsers will use to load specific parts like graphics).

You most probably wanted to use path= to specify the storage location for the files.

And when SAS complains about locations, follow your directory tree to make sure that everything is there where your program expects it to be. You may have used a non-existing directory or one where you don't have write permission.

PoulRavn
Obsidian | Level 7

Kurt, thanks, that clarified somewhat and made me able to run the example. I never mastered html in its own respect, which explains a little bit.

I am trying to modify size of graphs that are contained in the pages. How can I do that?

The statements like

graphics on / width=4.5in height=3.5in;

does not seem to impact the size. Do I need to use sgplot to be able to control the size or what? I have lots of sample programs from previous work, that use gplot, so I am not really keen on switching, as sgplot seems to be a quite different procedure with its own syntax.

Regards and thanks for the patience

Poul

Kurt_Bremser
Super User

If you use device-based graphics, the graph parameters need to be set in the goptions statement, see

SAS/GRAPH(R) 9.2: Reference, Second Edition

The ODS GRAPHICS statement affects only template-based procedures like sgplot, sgscatter, sgpanel and sgrender.

Kurt_Bremser
Super User

PS I found that developing at least a basic knowledge of HTML to be very helpful; sometimes I even create HTML from scratch (without ODS help) in a data _null_ step.

Ksharp
Super User

Not sure if it could work.

graphics on / reset=all width=4.5in height=3.5in;

Cynthia_sas
SAS Super FREQ

Hi, there isn't a "graphics on" statement. If the OP is using SAS/GRAPH procedures, then he needs to use the GOPTIONS statement and if the OP is using ODS GRAPHICS, then he needs to use the ODS GRAPHICS statement, not the "GRAPHICS" statement.

  Generally, when you are trying to control ODS output, especially ODS HTML output that creates graphs, you have to understand that HTML requires an <IMG> tag to point to the location of the image. So, generally instead of BASE=, which refers to the "base" url that should be used after the page  is created and when the page is on a web server. I prefer to use other options instead of BASE= (which usually requires that I know the naming convention on my web server -- which I don't) and instead, I use

ods html path='c:\temp' (url=none)

             gpath='c:\temp' (url=none)

             file='main.html'

             contents='toc.html'

             frame='frame.html';

*** code;

ods html close;

Then, this program will make ALL the HTML files and ALL the graph images in the C:\temp directory folder (otherwise, it makes the HTML file in one folder and usually makes the graphic image file in another folder). This also builds an <IMG> tag that has "relative" URL locations for the graphic images. So, this means that if you move ALL the HTML files and ALL the image files into the same directory on the web server, then when you open the FRAME.HTML file, it will contain all the correct links to load the frame navigation files and to load the image files into the display area of the web page.

As to whether you should use SAS/GRAPH or ODS GRAPHICS, that is totally up to you. SAS/GRAPH is great and gives you pixel by pixel control of your output. In some examples ODS GRAPHICS is easier and requires less annotation and less GREPLAY than older SAS/GRAPH programs. But if you have SAS/GRAPH programs, they will still work, as long as you have SAS/GRAPH licensed.

Here's some reading about the differences: https://support.sas.com/resources/papers/proceedings12/261-2012.pdf and https://support.sas.com/resources/papers/proceedings11/294-2011.pdf.

cynthia

ChrisHemedinger
Community Manager

For some basics about the options to set in SAS Enterprise Guide, see:

You'll learn how to suppress the automatic ODS output from EG and create the ODS output you want for your specific job.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
PoulRavn
Obsidian | Level 7

Hi, thanks to all answers here. Very helpful. It clarified a lot of my questions.

Poul

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 11 replies
  • 1703 views
  • 6 likes
  • 6 in conversation