02-15-2013 02:55 AM
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()]';
NOTE: The file CMDS is:
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?
02-15-2013 11:24 AM
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*/