DATA Step, Macro, Functions and more

DDE error

Reply
Contributor
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,

      SESSION=excel|system,RECFM=V,LRECL=256

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: 11,343

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
  • 376 views
  • 0 likes
  • 2 in conversation