<?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 Macroname in file name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macroname-in-file-name/m-p/542011#M149753</link>
    <description>&lt;P&gt;I wanna open the Excel file "January_Alex..xlsx". I'm using the following code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let name=Alex;

x '"C:\Folder\January_&amp;amp;name..xlsx" ';&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;But the problem is that SAS doesn't understand that "&amp;amp;name" is a macrovariable. I get the error message "Windows cannot find 'C:\Folder\January_&amp;amp;name..xlsx'. Make sure you typed the name correctly, and then try again"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how to fix it?&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2019 13:41:28 GMT</pubDate>
    <dc:creator>rhapsody</dc:creator>
    <dc:date>2019-03-11T13:41:28Z</dc:date>
    <item>
      <title>Macroname in file name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macroname-in-file-name/m-p/542011#M149753</link>
      <description>&lt;P&gt;I wanna open the Excel file "January_Alex..xlsx". I'm using the following code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let name=Alex;

x '"C:\Folder\January_&amp;amp;name..xlsx" ';&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;But the problem is that SAS doesn't understand that "&amp;amp;name" is a macrovariable. I get the error message "Windows cannot find 'C:\Folder\January_&amp;amp;name..xlsx'. Make sure you typed the name correctly, and then try again"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how to fix it?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 13:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macroname-in-file-name/m-p/542011#M149753</guid>
      <dc:creator>rhapsody</dc:creator>
      <dc:date>2019-03-11T13:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macroname in file name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macroname-in-file-name/m-p/542014#M149755</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248575"&gt;@rhapsody&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I wanna open the Excel file "January_Alex..xlsx". I'm using the following code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let name=Alex;

x '"C:\Folder\January_&amp;amp;name..xlsx" ';&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;But the problem is that SAS doesn't understand that "&amp;amp;name" is a macrovariable. I get the error message "Windows cannot find 'C:\Folder\January_&amp;amp;name..xlsx'. Make sure you typed the name correctly, and then try again"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas how to fix it?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS will not resolve macro references inside of single quotes. Use double quotes.&amp;nbsp; If you want to include double quotes in the string passed to DOS/Windows then double the embedded quotes;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"""C:\Folder\January_&amp;amp;name..xlsx"""&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or let the QUOTE() function do it for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let cmd="C:\Folder\January_&amp;amp;name..xlsx";
x %sysfunc(quote(&amp;amp;cmd));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Mar 2019 13:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macroname-in-file-name/m-p/542014#M149755</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-11T13:47:36Z</dc:date>
    </item>
  </channel>
</rss>

