%MACRO SAS2XLS(/* We took this from a sas-l posting by Ron Fehd, CDC-Atlanta, */ DSN /* SAS data set name (the part AFTER the libref) */ ,LIBRARY=LIBRARY /* SAS data set name - the libref part */ ,OUT = /* Name of the output Excel file, without the extension or path. Defaults to &dsn */ ,PATH =&PATH_XLS.); /* Output path, i.e. directory portion of the output file name */ %IF "&OUT." = "" %THEN %LET OUT = &DSN.; %*DOS x "del &PATH.\&OUT..XLS"; filename FILE2DEL "&PATH.\&OUT..XLS"; data _NULL_; Rc=fdelete('FILE2DEL'); SysMsg=sysmsg(); put Rc= SysMsg=; PROC DBLOAD dbms=EXCEL data=&LIBRARY..&DSN.; path="&PATH.\&OUT..XLS"; putnames yes; *****label; *****reset all; limit=0; load; run; %MEND; /* Sample Use: %sas2xls(dsn=togo,library=work,out=zipcode,path=%str(d:\temp)); This creates the xls file named zipcode.XLS in directory d:\temp. The data comes from work.togo. */