<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can I check to see if a DDE session is ready before trying to use it? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-I-check-to-see-if-a-DDE-session-is-ready-before-trying-to/m-p/85773#M18405</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Last I read about DDE, it's actually an issue with that the DDE software has to be opened first hence why in most examples you will see a data _null_; z=sleep(3);run; step in most DDE examples online to force SAS to wait 3 seconds (or more) to let excel open prior to sending the first few commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you already had such a sleep in your program and still were getting the error from another user having the file open, I'm sorry I can't be of much help beyond that. I can't think of an easy way to verify if an excel file can be open with write priviledges in SAS. Maybe check in excel-VBA documentation for a command to do so and instead of opening the workbook/sheet directly in your DDE statement, simply open excel.exe and use the open() excel command in your series of put statements to open the appropriate workbook/worksheet after using excel commands to verify that it's availible for writing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jul 2013 14:42:35 GMT</pubDate>
    <dc:creator>Vince28_Statcan</dc:creator>
    <dc:date>2013-07-22T14:42:35Z</dc:date>
    <item>
      <title>Can I check to see if a DDE session is ready before trying to use it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-check-to-see-if-a-DDE-session-is-ready-before-trying-to/m-p/85772#M18404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the documentation for DDE, there is an example that allows you to invoke commands in Excel, using a SAS data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example goes like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename cmds dde 'excel|system';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* These PUT statements are&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;/* executing Excel macro commands */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; file cmds;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; put '[SELECT("R1C1:R20C3")]';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; put '[SORT(1,"R1C1",1)]';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; put '[SAVE()]';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; put '[QUIT()]';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try to do this, sometimes I get the message that the DDE session is not ready, and so there is an ERROR in the SAS Log, just after data _null_.&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ERROR: DDE session not ready.&lt;/P&gt;&lt;P&gt;FATAL: Unrecoverable I/O error detected in the execution of the DATA step program.&amp;nbsp; Aborted during the EXECUTION phase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this happens because either I or someone else has opened the Excel file and not closed it before the SAS program executes. Is there a way that the SAS program can check to see if the DDE session is ready?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 13:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-check-to-see-if-a-DDE-session-is-ready-before-trying-to/m-p/85772#M18404</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-07-22T13:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can I check to see if a DDE session is ready before trying to use it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-check-to-see-if-a-DDE-session-is-ready-before-trying-to/m-p/85773#M18405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Last I read about DDE, it's actually an issue with that the DDE software has to be opened first hence why in most examples you will see a data _null_; z=sleep(3);run; step in most DDE examples online to force SAS to wait 3 seconds (or more) to let excel open prior to sending the first few commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you already had such a sleep in your program and still were getting the error from another user having the file open, I'm sorry I can't be of much help beyond that. I can't think of an easy way to verify if an excel file can be open with write priviledges in SAS. Maybe check in excel-VBA documentation for a command to do so and instead of opening the workbook/sheet directly in your DDE statement, simply open excel.exe and use the open() excel command in your series of put statements to open the appropriate workbook/worksheet after using excel commands to verify that it's availible for writing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 14:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-check-to-see-if-a-DDE-session-is-ready-before-trying-to/m-p/85773#M18405</guid>
      <dc:creator>Vince28_Statcan</dc:creator>
      <dc:date>2013-07-22T14:42:35Z</dc:date>
    </item>
  </channel>
</rss>

