Data visualization with SAS programming

Graphics within Excel

Reply
New Contributor
Posts: 2

Graphics within Excel

Hi there,

I have some difficulties with placing graphics within Excel.
I'd like to create an Excel report with a table output before and after and two graphics placed side by side in between.

Here is an code example:

%let path=C:\SAS\test;

ods tagsets.msoffice2k_x path="&path\reports" gpath="&path\reports\graphics" (url="graphics\") file="Test Report.xls" style=minimal

                         options(pagebreaks="no");
   title 'Test Report';
   proc print data=sashelp.class(where=(sex='F'));
   run;
ods tagsets.msoffice2k_x options(graph_width="520" graph_height="270" panelcols="2" panel_space="1");

   goptions device=PNG xpixels=520 ypixels=270;

   title 'Students female';

   proc gplot data=sashelp.class(where=(sex='F'));
      plot (weight height) * age  /
           OVERLAY
           hminor=1
           VZERO
           FRAME 
           AUTOVREF
           LEGEND
           NAME="graph_f";
   run;
   quit;
  
   title 'Students male';
   proc gplot data=sashelp.class(where=(sex='M'));
      plot (weight height) * age  /
           OVERLAY
           hminor=1
           VZERO
           FRAME 
           AUTOVREF
           LEGEND
           NAME="graph_m";
   run;
   quit;
  
   title 'Students male';
   proc gplot data=sashelp.class(where=(sex='M'));
      plot (weight height) * age  /
           OVERLAY
           hminor=1
           VZERO
           FRAME 
           AUTOVREF
           LEGEND
           NAME="graph_mm";
   run;
   quit;
  
ods tagsets.msoffice2k_x options(panelcols="1" panel_space="0");

   proc print data=sashelp.class(where=(sex='M'));
   run;
ods tagsets.msoffice2k_x close;

My points:
1. I put three graphics in this example to show, that the first graphic does not get a second at it's side, only in the next rows it will happen.

2. Below my graphics the table output is overlapped by these graphics.

3. The images I create are not overwritten but a number is counted up. How can I stop this?

    I tried with:   filename graphout "&path\graphics\";

                         goptions device=PNG gsfname=graphout gsfmode=replace;

   but it didn't helped.

   Also deleting the catalog work.grseg does not help.

SAS 9.2 and Excel 2010 are not on the same machines.
I would be delighted if someone could help me with one of these points.

Thanks
Matthias

Attachment
SAS Super FREQ
Posts: 8,641

Re: Graphics within Excel

Hi:

  I always find Excel a bit touchy about graphs. About half the time, it will plonk my image smack dab in the middle of a table, obscuring part of the table. TAGSETS.MSOFFICE2K_X is creating HTML with some embedded JavaScript and so I'm never sure how Excel is going to work. I tried the paneling example from this site: http://support.sas.com/rnd/base/ods/odsmarkup/msoffice2k/index.html#paneling a few months ago and got the same results in 9.3, but I no longer can test with 9.2 -- I'm not sure what's going on with your example,  but I can't test it, since I'm currently unhooked from a machine with SAS.

  You might consider opening a track with Tech Support. If there is a known issue or workaround for what you're observing, they should be able to help you.

cynthia

New Contributor
Posts: 2

Re: Graphics within Excel

The SAS version has no impact on the effects (I tested now with SAS 9.3).

I will open a track with Tech Support in parallel and tell here about results.

Post a Question
Discussion Stats
  • 2 replies
  • 321 views
  • 0 likes
  • 2 in conversation