<?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: resolve macro in filename in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/resolve-macro-in-filename/m-p/694255#M211716</link>
    <description>&lt;P&gt;Macro variables will not resolve inside single quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a workaround, you can use the macro variable &amp;amp;str where your FILENAME statement was.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let str=filename tmp pipe %str(%')dir "C:\SAS\Data\data _&amp;amp;dato._*.zip" /b%str(%');
%put &amp;amp;=str;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 26 Oct 2020 14:49:29 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-10-26T14:49:29Z</dc:date>
    <item>
      <title>resolve macro in filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/resolve-macro-in-filename/m-p/694251#M211714</link>
      <description>&lt;P&gt;I can not get this to work. It will not resolve the macro - why ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let dato=%sysfunc(putn(%eval(%sysfunc(today())-2),yymmddn8.));&lt;/P&gt;&lt;P&gt;%put &amp;amp;dato;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename tmp pipe 'dir "C:\SAS\Data\data _&lt;STRONG&gt;&amp;amp;dato.&lt;/STRONG&gt;_*.zip" /b';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 14:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/resolve-macro-in-filename/m-p/694251#M211714</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2020-10-26T14:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: resolve macro in filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/resolve-macro-in-filename/m-p/694255#M211716</link>
      <description>&lt;P&gt;Macro variables will not resolve inside single quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a workaround, you can use the macro variable &amp;amp;str where your FILENAME statement was.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let str=filename tmp pipe %str(%')dir "C:\SAS\Data\data _&amp;amp;dato._*.zip" /b%str(%');
%put &amp;amp;=str;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 14:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/resolve-macro-in-filename/m-p/694255#M211716</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-26T14:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: resolve macro in filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/resolve-macro-in-filename/m-p/694256#M211717</link>
      <description>&lt;P&gt;Macro variables inside single quotes do not resolve&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to look at this code:&lt;/P&gt;
&lt;PRE&gt;%let dato=%sysfunc(putn(%eval(%sysfunc(today())-2),yymmddn8.));
%put &amp;amp;dato;

%put in filename: 'dir "C:\SAS\Data\data _&amp;amp;dato._*.zip" /b';

%put in filename double quote: "dir ""C:\SAS\Data\data _&amp;amp;dato._*.zip"" /b";
&lt;/PRE&gt;
&lt;P&gt;to see that the macro variable is not resolving.&lt;/P&gt;
&lt;P&gt;The second version uses all double quotes and doubles the quotes around the path so that the single double quote doesn't get considered as the matching quote for the first one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 14:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/resolve-macro-in-filename/m-p/694256#M211717</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-26T14:51:26Z</dc:date>
    </item>
  </channel>
</rss>

