<?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: SAS MACRO statements with open excel document (DDE) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224977#M53890</link>
    <description>&lt;P&gt;I find that when I have issues similar to that making a single macro variable that contains the entire string is helpful. First I can debug the value before actually adding the complication of what ever is trying to use it. Also where multiple layers of quotes get involved I can find a single place to look for macro quoting issues.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Sep 2015 15:11:23 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-09-10T15:11:23Z</dc:date>
    <item>
      <title>SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224796#M53871</link>
      <description>&lt;P&gt;Hello all-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a small script as such&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename ddecmd dde 'excel|system';&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;file&amp;nbsp; ddecmd lrecl=500;;&lt;BR /&gt;put '[OPEN("T:\P_PPR\PPR_Program\xxx\PPR\2015MY\Report\ROS\2015 MidYear ROS Med Ctr All Outliers.xls")]';&lt;BR /&gt;&lt;BR /&gt;put '[SELECT("R10")]';&lt;BR /&gt;DO I = 1 TO 50;&lt;BR /&gt;put '[INSERT(2)]';&lt;BR /&gt;END;&lt;BR /&gt;put '[Save()]';&lt;BR /&gt;&lt;BR /&gt;put '[CLOSE("T:\P_PPR\PPR_Program\xxx\PPR\2015MY\Report\ROS\2015 MidYear ROS Med Ctr All Outliers.xls")]';&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works fine as is-&lt;/P&gt;&lt;P&gt;The issue I am having is attempting to embed this into a macro var as so that&lt;/P&gt;&lt;P&gt;put '[OPEN("T:\P_PPR\PPR_Program\xxx\PPR\2015MY\Report\&amp;amp;MEDCTR\2015 MidYear &amp;amp;MEDCTR Med Ctr All Outliers.xls")]';&lt;/P&gt;&lt;P&gt;becomes&lt;/P&gt;&lt;P&gt;put '[OPEN("T:\P_PPR\PPR_Program\xxx\PPR\2015MY\Report\&amp;amp;MEDCTR\2015 MidYear &amp;amp;MEDCTR Med Ctr All Outliers.xls")]';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The former analyst had this syntax:&lt;/P&gt;&lt;P&gt;put %unquote(%str(%'[open("T:\P_PPR\PPR_Program\QOS\PPR\2015MY\Report\&amp;amp;MEDCTR.\2015 MidYear &amp;amp;MEDCTR. Med Ctr All Outliers.xls")]'%));&lt;/P&gt;&lt;P&gt;but it does not seem to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried a couple of other ways to no avail-&lt;/P&gt;&lt;P&gt;Any assistance greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lawrence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 17:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224796#M53871</guid>
      <dc:creator>LB</dc:creator>
      <dc:date>2015-09-09T17:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224841#M53877</link>
      <description>&lt;P&gt;It helps to describe how the code doesn't work. Does it generated errors, if so please describe them.&lt;/P&gt;&lt;P&gt;Does the speadsheet exist before you open it? Does the folder exist?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 20:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224841#M53877</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-09T20:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224848#M53878</link>
      <description>&lt;P&gt;Ballard-&lt;/P&gt;&lt;P&gt;To your questions- Both the file and the folder exists already.&amp;nbsp; In addition, excel is already open as well (through an X command)&lt;/P&gt;&lt;P&gt;As to the errors-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As is without the macro input the script works fine. If you attempt to use the macro language as stated in the thread&amp;nbsp; then nothing happens-&lt;/P&gt;&lt;P&gt;I have tried a couple of other iterations that have resulted in the file not being found as the Macro vars remain undefined.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lawrence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 20:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224848#M53878</guid>
      <dc:creator>LB</dc:creator>
      <dc:date>2015-09-09T20:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224850#M53879</link>
      <description>&lt;P&gt;I realized there was an error in description:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works fine as is-&lt;/P&gt;&lt;P&gt;The issue I am having is attempting to embed this into a macro var as so that&lt;/P&gt;&lt;P&gt;put '[OPEN("T:\P_PPR\PPR_Program\xxx\PPR\2015MY\Report\&amp;amp;MEDCTR\2015 MidYear &amp;amp;MEDCTR Med Ctr All Outliers.xls")]';&lt;/P&gt;&lt;P&gt;properly is rendered as:&lt;/P&gt;&lt;P&gt;put '[OPEN("T:\P_PPR\PPR_Program\xxx\PPR\2015MY\Report\ROS\2015 MidYear ROS Med Ctr All Outliers.xls")]';&lt;/P&gt;&lt;P&gt;And opens the file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 21:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224850#M53879</guid>
      <dc:creator>LB</dc:creator>
      <dc:date>2015-09-09T21:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224899#M53884</link>
      <description>&lt;P&gt;Try to switch the use of quotes. When you want macro variables to be substituted by their content in a string, the outermost quotes should be double quotes. Inside the string you can then use single quotes without problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 05:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224899#M53884</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-09-10T05:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224977#M53890</link>
      <description>&lt;P&gt;I find that when I have issues similar to that making a single macro variable that contains the entire string is helpful. First I can debug the value before actually adding the complication of what ever is trying to use it. Also where multiple layers of quotes get involved I can find a single place to look for macro quoting issues.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 15:11:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224977#M53890</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-10T15:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224992#M53894</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Try this, it worked for me&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put "[OPEN(""T:\P_PPR\PPR_Program\xxx\PPR\2015MY\Report\&amp;amp;MEDCTR\2015 MidYear &amp;amp;MEDCTR Med Ctr All Outliers.xls"")]";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Replace outer single quote ['] with double quote["]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Replace inner double quote ["] with [""]&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 16:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/224992#M53894</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-10T16:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO statements with open excel document (DDE)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/225049#M53901</link>
      <description>Reeza; That worked! Thank you! Lawrence</description>
      <pubDate>Thu, 10 Sep 2015 22:15:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-MACRO-statements-with-open-excel-document-DDE/m-p/225049#M53901</guid>
      <dc:creator>LB</dc:creator>
      <dc:date>2015-09-10T22:15:12Z</dc:date>
    </item>
  </channel>
</rss>

