DDE(Dynamic Data Exchange):

Dynamic Data Exchange (DDE) is a method of dynamically exchanging information between Windows applications.
DDE is “Dynamic Data Exchange” and is a method of accessing data from one
MS-Windows application by another. As a SAS user, you can use DDE within a
DATA step to import data into SAS and export data from SAS.

With the popularity of Excel files, the SAS user could use an easy way to get Excel files into SAS. There are many good methods to do so, one of them being Dynamic Data Exchange (DDE). A SAS user can use DDE within SAS code to make importing an Excel file routine and easily repeatable.

But, why bother with DDE when other methods are available?
What about the IMPORT and EXPORT procedures?
Or, Open Database Connectivity (ODBC)?
How about SAS Enterprise Guide?
These alternatives are useful under the right conditions.
For example, the PROC IMPORT and PROC EXPORT are simple to use, but are limited in the way you can define your data and these procedures require you license SAS/ACCESS For PC Formats. Bummer.
ODBC is also simple to use, but importing data into SAS using ODBC requires you license SAS/ACCESS For ODBC. Bummer again.
And, the new Excel LIBNAME engine? Oh, that also requires you license SAS/ACCESS For PC Formats. Bummer times three.
SAS Enterprise Guide is very simple, and does not require you license anything other
than BASE SAS. Hmm.
Oh yes, SAS Enterprise Guide doesn’t offer quite the flexibility as DDE, because when using DDE you have all the features of the SAS DATA step. Also, using DDE in a SAS DATA step makes it easy to adapt the import process for repeatable uses. A SAS DATA step using DDE only requires BASE SAS running under MS-Windows.

Options noxwait noxsync;
X ‘”C:\Program Files\Microsoft Office\Office12\Excel.exe”‘;
Data _null_;
x=sleep(3);
Run;
Filename cmds dde ‘excel|system’;
Data _null_;
File cmds;
Put ‘[open(“C:\Documents and Settings\Administrator\Desktop\SAS\sample1.xls”)]’;
Run;
Filename test1 dde ‘excel|sheet1!r7c7:r26c11’ notab;
Data _null_;
Set sashelp.class;
File test;
Put name ’09’x sex ’09’x age ’09x’ height ’09x’ weight ’09x’;
Run;
Filename test2 dde ‘excel|system’;
Data _null_;
File test2;
Put ‘[save.as(C:\Documents and Settings\Administrator\Desktop\SAS\sample2.xls”])’;
Put ‘[close]’;
Put ‘[exit]’;
Run;