this is piece of SAS code that I use to control my output to Excel. Not sure if this assist in your request, but maybe it has something in the EXCEL part that will. /* This macro creates a dataset with all the field's of the old dataset.
A where claus is used to obtain only those records needed.
The dataset is ordered by two fields. */
%macro sqlcreat(olddata=,newtable=,wvar=,wvalue=,obone=,obtwo=);
proc sql;
create table &newtable. as
select *
from &olddata.
where &wvar. = &wvalue.
order by &obone., &obtwo.;
quit;
%mend;
/* This macro will create a new dataset in a sorted order, or it will
sort a dataset if the newset value is equal to the olddata value. */
%macro sortone(olddata=,newset=,byvar=);
proc sort data=&olddata. out=&newset.;
by &byvar.;
run;
%mend;
/* This macro is used to merge a dataset named dummy (who's number of fields and
records are equal to the largest number of possible result's for the
old dataset.) */
%macro mergeit(new_ds=,old_ds=,byvar=);
data &new_ds.;
merge dummy(in=in_t)
&old_ds.(in=in_f);
by &byvar.;
run;
%mend;
options noxwait noxsync mlogic;
X "C:\Program Files\Microsoft Office\Office\EXCEL.EXE";
data _null_;
x=sleep(5);
run;
filename cmds dde 'excel|system';
data _null_;
length mystuff $250;
file cmds;
pre_book = '[open("'||"&temppath.\&workbook."||'")]';
put pre_book;
run;
filename outpre dde
"Excel|&temppath.\[&workbook.]&sheet.!r1c1:r561c10" notab;
/* put the information into the cells in the worksheet */
data _null_;
file outpre notab;
put '09'x'09'x'09'x"&mytitle.";
set head_date; /* contains the results in a SAS dataset */
file outpre notab;
put '09'x'09'x'09'xprt_month", " prt_year;
put /* results from the macros output that is in datasets */;
run;
... View more