BookmarkSubscribeRSS Feed
Matthias
Calcite | Level 5

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


excel_output.jpg
2 REPLIES 2
Cynthia_sas
SAS Super FREQ

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

Matthias
Calcite | Level 5

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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 847 views
  • 0 likes
  • 2 in conversation