我想使用SAS操作现有的Excel表格:
我有以下代码(小心!我使用z表示r(ows),s表示c(列)因为Excel中的德语设置):
option noxwait noxsync;
x call "C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE";
%let delay=5;
data _null_;
rc=sleep(&delay);
run;
filename sas2xl dde 'excel|system';
data _null_;
rc=sleep(&delay);
run;
%let mapwkbk=H:\odstest.xlsx;
data _null_;
file sas2xl;
rc=sleep(&delay);
put '[open("' "&mapwkbk" '")]';
run;
filename random dde 'excel|Daten!z2s1:z100s3';
data _null_;
set sashelp.class;
file random;
put name sex age;
run;
data _null_;
file sas2xl;
/*rc=sleep(&delay);*/
put '[workbook.select("Pivot")]';
put '[select("Z2S1")]';
put "[pivot.refresh()]";
put '[workbook.select("Daten")]';
put '[select("z1S2:z1s5")]';
put '[filter]';
put '[select("z1S10")]';
put '[filter]';
put '[column.width(0,"s1",false,1)]';
put '[column.width(0,"s6:s9",false,1)]';
put '[workbook.delete("Dim")]';
/*put "[save()]";*/
/*put "[quit()]";*/
run;
现在我想折叠数据透视表的某些列。如何达到这个目标?