Following are instructions using SAS Enterprise Guide 7.15 HF8, SAS Add-in for Microsoft Office 8.2 Update 4, and 9.4 M6.
Access SAS Enterprise Guide and then create a new program with this code:
%macro create_workbook(model_tier=);
* Specify the worksheet name;
ods &_ODSDEST options(sheet_name="Model Tier: &MODEL_TIER");
proc report data=sashelp.cars;
where (type eq "&MODEL_TIER");
columns Type Make Model;
define Type / 'Model Tier';
run; quit;
%mend create_workbook;
%let RC = %sysfunc(stpsrv_header(Content-type, application/vnd.ms-excel));
* Specify ODS destination;
%let _ODSDEST=tagsets.ExcelXP;
%STPBEGIN()
* First worksheet;
%CREATE_WORKBOOK(model_tier=Sedan)
* Second worksheet;
%CREATE_WORKBOOK(model_tier=Wagon)
* Third worksheet;
%CREATE_WORKBOOK(model_tier=SUV)
%STPEND()
Right-click on the program node and the select Create Stored Process.
Specify a name and location for the stored process and then select Next.
Deselect the Include code for Stored process macros checkbox in the SAS Code dialog, and then select Next.
In the Execution Options dialog, specify a location to store the SAS code, and then select only Stream for Result capabilities. Select Finish.
Access Excel and then run the stored process using the SAS Add-In for Microsoft Office. A dialog with this text is presented when the stored processes completes execution:
The stored process created an Excel Workbook
The stored process forced the generation of an Excel workbook. The SAS Add-In for Microsoft Office can open the Excel Workbook, but will not track it as refreshable content.
Select Open document to open the Excel workbook. There are 3 worksheets named "Model Tier Sedan", "Model Tier Wagon", and "Model Tier SUV"
Vince DelGobbo
SAS R&D
... View more