BookmarkSubscribeRSS Feed
keyreal
Calcite | Level 5
Hello all!
I have been using DDE to automate my SAS reports by sending commands to MS Excel regarding formatting, sub-totals, etc. However, our company is switching from PC SAS to Unix SAS which does not support DDE. Does anybody know any close alternative of the "DDE" functionality that would allow me to automate SAS reports exported to Excel? Thanks!
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
You can generate subtotals for your data with PROC REPORT and/or PROC TABULATE and/or PROC PRINT. To have Excel respect the formatting (colors and fonts and print controls), have you tried ODS???

ODS HTML or ODS MSOFFICE2K can create ASCII text HTML files that Excel can open and render -- the downside of HTML methods is that while formatting is respected, printing controls and multi-sheet workbooks are harder to achieve.

ODS TAGSETS.EXCELXP can create ASCII text Spreadsheet Markup language XML files that Excel can open and render. Formatting (colors and fonts) is do-able and print control is do-able (using suboptions) and multi-sheet workbooks that respect the formatting canbe easily achieved. The downside of TAGSETS.EXCELXP is that graph object insertion is not allowed (by Microsoft design -- for the XML file).

Depending on what you were doing with your DDE, you might find that TAGSETS.EXCELXP is an alternative.

The program below uses a PROC REPORT to produce subtotals with spanning headers and formatting changes shown with both ODS MSOFFICE2K and ODS TAGSETS.EXCELXP. You can compare the two outputs to see which might work best for you.

cynthia
[pre]
ods tagsets.ExcelXP file='websales_xml.xls' style=sasweb;
ods msoffice2k file='websales_ht.xls' style=sasweb;
proc report data=sashelp.shoes nowd;
where region in ('Asia', 'Canada', 'Pacific');
title 'Region Sales';
column ('Spanning Header1' Region Product) ('Other Header' Sales n);
define Region /group;
define Product / group;
define Sales / mean "Avg Sales";
define n / 'Number of Sales';
break after region / summarize;
rbreak after /summarize;
compute after region;
line ' ';
endcomp;
run;

proc report data=sashelp.shoes nowd;
where region in ('Asia', 'Canada', 'Pacific');
title 'Product Sales';
column ('Spanning Header1' Product Region) ('Other Header' Sales n);
define Product /group;
define Region / group;
define Sales / mean "Avg Sales";
define n / 'Number of Sales';
break after product / summarize;
rbreak after /summarize;
compute after product;
line ' ';
endcomp;
run;
ods _all_ close;
title;
[/pre]

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!

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.

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
  • 1 reply
  • 1370 views
  • 0 likes
  • 2 in conversation