Data visualization with SAS programming

HELP :) basic question

Reply
Contributor
Posts: 30

HELP :) basic question

Hi!
When I run this code, i get the graph I want as html result viewer,
but not as a GIF image. The GIF i get is much smaller then what i want
(the x axis' scale mark take a lot of room, and so it takes half of
the graph's surface-and leave only half for the graph itself.
How can I get the same graph i get in my result viewer?
I also want to ODS_output it.
Thanks a lot Smiley Happy

PS How can i add an attachment so that you can see what I'm talking about?

GOPTIONS XPIXELS=0 YPIXELS=0 DEV=ACTIVEX;
symbol1 i =join v=dot c=green h=0.15 cm;
symbol2 i =join v=dot c=blue h=0.15 cm;
symbol3 i =join v=dot c=red h=0.15 cm;
axis1 order=('4aug02:00:00'dt to '11aug02:00:00'dt by '24:00:00't)
label=(f=swiss h=0.5 cm 'Date and Time') minor=(number=24);
axis2 order = (0 to 280 by 10)
label=(f=swiss h=0.5 cm a=90 'NOx [ppb]');
proc gplot gout=nox_mean data=aug_02_excel;
plot Nox* d=stat_id /vaxis = axis2 haxis=axis1;
format d datetime18.;
where day in (4,5,6,7,8,9,10);
run; quit;
SAS Super FREQ
Posts: 8,720

Re: HELP :) basic question

Hi:
If you want a GIF image and HTML output, then you need to use
[pre]
goptions dev=GIF;
[/pre]

or one of the other gif drivers (such as GIF570 or GIF733). Since you have DEV=ACTIVEX in your code snippet, you should know that DEV=GIF will not have any of the interactivity of the ACTIVEX driver.

In addition, I'm not sure what you mean by "ODS_output it", but assuming you mean that you want an ODS output file, such as HTML, RTF or PDF, then you would:
[pre]
ods html path='c:\temp' (url=none)
gpath='c:\temp' (url=none)
file='page_w_img_tag.html';

.... sas/graph code with device=GIF ....

ods _all_ close;
[/pre]

When you open the above file with Notepad, look for the <IMG> tag, that will show you the name of the GIF file that was created. The PATH= and GPATH= options guarantee that the HTML file and the graphic image file(s) are stored in the same physical directory on your system. The (URL=NONE) suboption tells ODS not to use the physical location in any SRC= value that is built in the HTML file.

If you want to create an RTF or PDF file, remember that images are embedded into those files, so even though you might specify DEV=GIF, the images are converted to internal RTF or PDF formats and do not exist as external files.

As an alternative to using ODS HTML, you can also use the GSFNAME and FILENAME methods of creating an external image -- however -- this method does NOT use ODS, so I doubt that is what you're referring to.

Here are some links that may help you figure out how to proceed:
http://support.sas.com/kb/23/638.html
http://support.sas.com/kb/25/567.html
http://support.sas.com/kb/23/640.html

As for sizing issues and your use of XPIXELS and YPIXELS, you might want to consult the documentation and Tech Support notes:
http://support.sas.com/kb/4/026.html
http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/a003283226.htm (look at the topic section entitled "Using the XPIXELS=, XMAX=, YPIXELS=, and YMAX= Graphics Options to Set the Resolution for Device-Based Graphics")

Also, if you are using SAS 9.1.3, and you want the output to use style template information to create your static images, you might want to use the ACTXIMG driver instead of the GIF driver.

cynthia
Contributor
Posts: 30

Re: HELP :) basic question- What's wrong with my code...?

Hi,
Thanks for your reply.
The problem is that when i specify DEVICE=GIF then the result i get is the one with half surface for graph itself, and half for the scale marks( this was my problem).
Can I add an attachment so that you can see it?

Is there

Here's the code:

ods html path='C:\temp' (url=none)
gpath='C:\temp' (url=none) file='test.html';
GOPTIONS XPIXELS=0 YPIXELS=0 DEV=GIF;
symbol1 i =join v=dot c=green h=0.15 cm;
symbol2 i =join v=dot c=blue h=0.15 cm;
symbol3 i =join v=dot c=red h=0.15 cm;
axis1 order=('4aug02:00:00'dt to '11aug02:00:00'dt by '24:00:00't)
label=(f=swiss h=0.5 cm 'Date and Time') minor=(number=24);
axis2 order = (0 to 280 by 10)
label=(f=swiss h=0.5 cm a=90 'NOx [ppb]');
proc gplot gout=aa data=aug_02_excel;
plot Nox* d=stat_id /vaxis = axis2 haxis=axis1;
format d datetime18.;
where day in (4,5,6,7,8,9,10);
run; quit;
ods _all_ close;
SAS Super FREQ
Posts: 8,720

Re: HELP :) basic question- What's wrong with my code...?

Hi:
As I said, to learn how to resize your GIF image when you use the GIF driver, investigate the documentation:

http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/a003283226.htm (look at the topic section entitled "Using the XPIXELS=, XMAX=, YPIXELS=, and YMAX= Graphics Options to Set the Resolution for Device-Based Graphics")

In addition to XPIXELS, XMAX, YPIXELS and YMAX, you should also investigate HSIZE and VSIZE
http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/gopdict-hsize.htm
http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/gopdict-vsize.htm
http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/programs-sizeerror.htm
http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/programs-modgoa.htm
http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/a003284816.htm
http://support.sas.com/documentation/cdl/en/graphref/61884/HTML/default/a003282728.htm

If you continue to have issues with the GIF driver after reading the documentation, you might wish to contact Tech Support, as they can help you with a solution that is appropriate for your SAS version (9.1.3 vs 9.2) and your operating system.

cynthia
Contributor
Posts: 30

Re: HELP :) basic question- What's wrong with my code...?

Hi!
Thanks a lot!!

I tried hsize and vsize> but it does a completly diffrent thing.
I'm not sure the I explained the problem well enough,
I realy have to attach a picture of what I get, and what I need. How can I do this?



as for XPIXELS=, YPIXELS=, XMAX=, and YMAX=

It says on your link:


Note: The XPIXELS=, YPIXELS=, XMAX=, and YMAX= graphics options are not supported by the default display devices and the Universal Printer devices, including the shortcut devices. These graphics options are partially supported by the ACTIVEX and JAVA devices. [cautionend]

Note: The resolution of GIF and BMP images is fixed and cannot be changed using this method. [cautionend]

And I need it in a GIFor BMP file.

The weird thing is that I had all this graphs OK, but I only wanted to change the title 'date and time' to 'Date and Time'- so nothing should have changed.

The only thing that I've change lately was adding an autoexec file with the following options:

goptions
reset= global
device=win
target= lj3sipsl
gouttype=independent
ftext=swiss
i=j
rotate = landscape
horigin=l ,0 in
vorigin=O.75 in
hsize = 8.5 in
vsize = 6.95 in
hpos = 80
Vpos = 50
gunit=pct

cback=white
colors= (black)
;

Could this be the reason.

Thanks for your help again Smiley Happy
SAS Super FREQ
Posts: 8,720

Re: HELP :) basic question- What's wrong with my code...?

Hi:
I thought you wanted to change the size, not the resolution. For example, if you run the code below, you will see that the first output is smaller than the second output -- and the horizontal axis is treated differently by PROC GPLOT based on the differing sizes specified for HSIZE and VSIZE.

You ask whether it is possible for your AUTOEXEC options to have an impact on your graph output. Absolutely. Since some GOPTIONS are cumulative in each session, it is entirely possible that you are ending up with conflicting options.

You cannot attach pictures or screenshots to forum postings. However, if you open a track with Tech Support, you can send screenshots, log output and other output to them. To open a track with Tech Support, go to:
http://support.sas.com/ctx/supportform/createForm

cynthia

[pre]
proc means data=sashelp.prdsale mean nway;
where year(month) = 1993;
class month country;
var actual;
output out=work.mnout mean=Actmean;
format month monyy5.;
run;

ods listing close;
options gstyle;
goptions reset=all hsize=4in vsize=3in dev=gif;
symbol1 i=join;

ods html path='c:\temp'(url=none)
gpath='c:\temp' (url=none)
file='img4by3.html' style=listing;
proc gplot data=work.mnout;
plot Actmean * Month=Country /
haxis=('01jan1993'd, '01feb1993'd, '01mar1993'd
'01apr1993'd, '01may1993'd, '01jun1993'd
'01jul1993'd, '01aug1993'd, '01sep1993'd
'01oct1993'd, '01nov1993'd, '01dec1993'd);
format month monyy5.;
run;
quit;
ods html close;

goptions reset=all hsize=8in vsize=6in dev=gif;
symbol1 i=join;

ods html path='c:\temp'(url=none)
gpath='c:\temp' (url=none)
file='img8by6.html' style=listing;

proc gplot data=work.mnout;
plot Actmean * Month=Country /
haxis=('01jan1993'd, '01feb1993'd, '01mar1993'd
'01apr1993'd, '01may1993'd, '01jun1993'd
'01jul1993'd, '01aug1993'd, '01sep1993'd
'01oct1993'd, '01nov1993'd, '01dec1993'd);
format month monyy5.;
run;
quit;
ods html close;

goptions reset=all;
title; footnote;


[/pre]
Ask a Question
Discussion stats
  • 5 replies
  • 143 views
  • 0 likes
  • 2 in conversation