Database Reference
In-Depth Information
Figure 11.5.2 has a list of common default locations for where Microsoft Excel is installed; your location
may be different. Ask your Information Technologies Department if your location is different.
This example also introduces two new features of the DDE commands. The options NOTAB and LRECL
are introduced in this example. The NOTAB option limits the output of ASCII tab characters ('09'x).
Typically, the tab characters cause the data following a tab to be placed into the next Excel cell of the
worksheet. The LRECL ( L ogical REC ord L ength) option limits the number of characters output into an
individual cell in the Excel worksheet. The word “World” is truncated to “Worl” because the constant
“Hello World” is 11 bytes long and the LRECL=10 allowed only 10 bytes to be output.
Figure 11.6.8a: SAS DDE Code to Write 10 Characters “Hello Worl” to the Output Excel File
in One Cell.
OPTIONS NOXWAIT NOXSYNC;
/* Use to X command to start Excel 2013*/
%let Excel_path =
'C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE';
* no spaces in file path or name;
%let Excel_file = C:\Excel_Files\Book3.xlsx;
X "&Excel_Path. /x &excel_file.";
DATA _NULL_;
x = sleep(10); * Allow enough seconds for Excel to open;
RUN;
FILENAME ddewrite DDE 'excel|C:\Excel_Files\[Book3.xlsx]Sheet1!r1c1:r1c2'
NOTAB LRECL=10;
/* using NOTAB will 'Hello World' text to be placed on one cell */
/* using LRECL=10 to write 11 characters will truncate the string */
DATA OUT;
FILE ddewrite;
x='Hello World';
PUT x;
RUN;
Figure 11.6.8b: SAS DDE Code to Write 10 Characters “Hello Worl” to the Output Excel File
in One Cell.
 
Search WWH ::




Custom Search