<?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 Problem use x command to open Excel in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77876#M22483</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can open Excel console by useing the following SAS code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noxwait noxsync;&lt;/P&gt;&lt;P&gt;x '"C:\Program Files\Microsoft Office\Office12\EXCEL"';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My question is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if I want to use a macro variable express the location of Excel, then it will cause the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noxwait noxsync ;&lt;/P&gt;&lt;P&gt;%let aaa=C:\Program Files\Microsoft Office\Office12\EXCEL;&lt;/P&gt;&lt;P&gt;x '"&amp;amp;aaa"'; &lt;STRONG&gt;/*This will cause problem*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Sep 2012 14:31:37 GMT</pubDate>
    <dc:creator>Mike_Davis</dc:creator>
    <dc:date>2012-09-26T14:31:37Z</dc:date>
    <item>
      <title>Problem use x command to open Excel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77876#M22483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can open Excel console by useing the following SAS code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noxwait noxsync;&lt;/P&gt;&lt;P&gt;x '"C:\Program Files\Microsoft Office\Office12\EXCEL"';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My question is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if I want to use a macro variable express the location of Excel, then it will cause the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noxwait noxsync ;&lt;/P&gt;&lt;P&gt;%let aaa=C:\Program Files\Microsoft Office\Office12\EXCEL;&lt;/P&gt;&lt;P&gt;x '"&amp;amp;aaa"'; &lt;STRONG&gt;/*This will cause problem*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 14:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77876#M22483</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-09-26T14:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem use x command to open Excel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77877#M22484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike: How about?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noxwait noxsync ;&lt;/P&gt;&lt;P&gt;%let aaa=%nrbquote("C:\Program Files\Microsoft Office\Office12\EXCEL");&lt;/P&gt;&lt;P&gt;x &amp;amp;aaa;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 15:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77877#M22484</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-26T15:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem use x command to open Excel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77878#M22485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Art!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I have a question,&lt;/P&gt;&lt;P&gt;&amp;amp;aaa can be explained to "C:\Program Files\Microsoft Office\Office12\EXCEL".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you use x &amp;amp;aaa; equal to use x "C:\Program Files\Microsoft Office\Office12\EXCEL".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there missing a couple of '', why still work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 15:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77878#M22485</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-09-26T15:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem use x command to open Excel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77879#M22486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The actual problem is with Windows (or really DOS) and not SAS.&amp;nbsp; Your filename has embedded spaces. This can confuse DOS because you might mean that you want it to run the program "C:\Program" with two command line options of "Files\Microsoft" and "Office\Office12\EXCEL".&amp;nbsp; To clarify for DOS what you mean you need to enclose the filename in quotes.&amp;nbsp; SAS is stripping the outer quotes before passing the string to DOS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So add an extra set of quotes.&lt;/P&gt;&lt;P&gt;You can double the interior quotes.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;x """&amp;amp;aaa""";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or use the QUOTE() function to do that for you:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;x %sysfunc(quote("&amp;amp;aaa"));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect that why the %BQUOTE() function worked is because it prevented SAS from stripping off the outer quotes before sending the filename to DOS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2012 16:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77879#M22486</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-09-26T16:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem use x command to open Excel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77880#M22487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or You can add the path of excel into environment variable PATH , then you can directly use command EXCEL .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x "excel" ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 01:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Problem-use-x-command-to-open-Excel/m-p/77880#M22487</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-09-27T01:51:29Z</dc:date>
    </item>
  </channel>
</rss>

