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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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