BookmarkSubscribeRSS Feed
Virpi
Calcite | Level 5

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?

1 REPLY 1
ballardw
Super User

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));

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1030 views
  • 0 likes
  • 2 in conversation