Database Reference
In-Depth Information
Result:
This macro opens the Excel file, but does not establish any filename connections to the Excel file. In other
words, no DDE-triplets are opened by this macro. No data ranges or command paths are established by this
macro.
RESTRICTIONS:
If this macro fails to start the Excel workbook, it may be because the time for the operating system to
respond exceeded the wait time parameter. Increase the amount of time for the wait time parameter and
resubmit.
11.4.2 SAS Macro to SAS to Issue Commands to Excel
Macro Name:
Open_cmd
FUNCTION:
Open an Excel DDE-triplet to issue Excel commands from SAS.
PARAMETERS:
This macro accepts the following parameters:
Full Excel Path and File name
Length of time to wait for the FILENAME command
This macro accepts a fileref name used to build an Excel DDE-triplet to issue commands to Excel from
SAS. The macro verifies that a FILEREF name was provided, but does not verify that the FILEREF is
valid. Any valid SAS FILEREF can be provided. If the FILEREF is the same as one already used, the new
FILEREF will override the previous FILEREF and DDE-triplet if the FILEREF pointed to a DDE-triplet.
After the SAS FILENAME command is executed, the SAS program waits to allow Excel to become fully
operational before returning control back to the SAS runtime environment. If the default waiting period of
eight seconds is not the right amount of time, then the “WAIT” parameter can be adjusted to fine-tune the
wait time needed.
Result:
This macro establishes a FILENAME connection to the Excel file using the DDE “excel|system” triplet to
open a command path to Excel.
RESTRICTIONS:
If this macro fails to start the Excel workbook, it may be because the time for the operating system to
respond exceeded the wait time parameter. Increase the amount of time for the wait time parameter and
resubmit.
11.4.3 SAS Macro to Define a Range of Excel Cells for Processing
Macro Name
Out_range
FUNCTION:
Open an Excel DDE-triplet to transfer data between SAS and Excel.
 
Search WWH ::




Custom Search