· 7 years ago · Nov 11, 2018, 11:34 PM
1filename myxl 'c:tempsandbox.xlsx';
2
3proc export replace file=myxl dbms=excel
4 data=sashelp.class (keep=name)
5;
6 sheet='Name';
7run;
8
9proc export replace file=myxl dbms=excel
10 data=sashelp.class (keep=name age weight)
11;
12 sheet='Weight';
13run;
14
15%macro excel_push (file=, data=, always=, each=);
16 %local i n var;
17 %let n = %sysfunc(countw(&each));
18 %do i = 1 %to &n;
19 %let var = %scan(&each,&i);
20
21 proc export replace file=&file dbms=excel
22 data=&data(keep=&always &var)
23 ;
24 sheet="&var";
25 run;
26
27 %end;
28
29%mend;
30
31options mprint;
32
33filename myxl2 'c:tempsandbox2.xlsx';
34
35%excel_push (
36 file=myxl2,
37 data=sashelp.class,
38 always=name age sex,
39 each=height weight
40)
41
42ERROR: Error attempting to CREATE a DBMS table. ERROR: Execute: The Microsoft Access database
43 engine could not find the object ********. Make sure the object exists and that you spell
44 its name and the path name correctly. If ******** is not a local object, check your
45 network connection or contact the server administrator..