BookmarkSubscribeRSS Feed
ari
Quartz | Level 8 ari
Quartz | Level 8

Hi,

 

I am wondering if there is a way to automate the process of sending the generated graphs from a macro call directly to powerpoint.

 

Any ideas if this can be achieved in sas?

 

eg: my macro call:

 

%plot(data=test, var=endpoint, inputvar=adt ,xlabel=,ylabel=,xval=,title=%str('end point'));

 

6 REPLIES 6
Reeza
Super User

Do you have SAS 9.4? 

 

If so then yes, PowerPoint is a valid destination. 

 

Ods powerpoint file='path to new file.pptx' style=meadow;

 

macro calls...

 

ods powerpoimt close;

 

See detailed examples here:

https://support.sas.com/resources/papers/proceedings13/041-2013.pdf

ari
Quartz | Level 8 ari
Quartz | Level 8

Hi Reeza,

 

Thanks, with that option I could export one graph at a time but I want to export several (about 20) plots to export. Is that possible as well?

Reeza
Super User

Sure, just depends on where you place your ODS statement. 

 

If all your macro statements go between the ODS statements all your graphs go to the ODS destination. 

The code initially illustrates this, you place all your macro statements between the ODS statements. 

 

 

ari
Quartz | Level 8 ari
Quartz | Level 8

Hi Reeza,

 

I put all the macro statements between the ODS statements.

 

But still it didnt solve the issue.

 

I see in the log this error and I cant see anything in the ppt file (it says ppt file is in use)

 

ERROR: ZIP entry duplicate name: ppt/media/SGPlot1.png

 

Is there any solution this issue?

 

Thanks in advance.

Reeza
Super User

Without your code, No.

 

Make sure that the Powerpoint is closed and that your creating graphs with unique names. 

Reeza
Super User

Here's an example that demonstrates how it works.

 

ods powerpoint file='/folders/myfolders/out.pptx' style=meadow;

title 'Class - Height by Weight';
proc sgplot data=sashelp.class;
scatter x=height y=weight;
run;

title 'Cars - City vs Highway MPG';
proc sgplot data=sashelp.cars;
scatter x=mpg_city y=mpg_highway;
run;

ods powerpoint close;

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
  • 6 replies
  • 1292 views
  • 0 likes
  • 2 in conversation