DATA Step, Macro, Functions and more

DDE error

Posts: 21

DDE error

I have working code for DDE. If I add select-statement into my code it gives an error.

135  filename cmds dde 'excel|system';

136  data _null_;

137  file cmds;

138  put '[select("R1C1")]';

139  put '[QUIT()]';

140  run;

NOTE: The file CMDS is:

      DDE Session,


ERROR: DDE session not ready.

FATAL: Unrecoverable I/O error detected in the execution of the DATA step program.  Aborted during the EXECUTION phase.

NOTE: 0 records were written to the file CMDS.

NOTE: The SAS System stopped processing this step because of errors.

Why is this?

Super User
Posts: 13,523

Re: DDE error

Excel needs to be open and running to receive the DDE commands. The "DDE session is not ready" error makes it look like Excel may not have been ready (fully started and waiting)

I use this code before the filename statement to make sure Excel is ready.


%let rc=%sysfunc(system(start Excel));

/* wait to make sure excel is done starting the number is seconds of delay

the value in sleep can be smaller for faster disk drives*/

%let rc=%sysfunc(sleep(2));

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation