<?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: argument in filename() in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/argument-in-filename/m-p/471227#M120680</link>
    <description>&lt;P&gt;Because filerf is the name you passed to the filename reference to create the reference. If you used the ampersand in both cases it works as well. That's the key - use it both or don't use it both.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; filrf&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;myfile&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; rc&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token macrostatement"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;filrf&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; physical&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;; &amp;lt;- if this was &amp;amp;filrf you need it in the next step as well. If not, it's the string filrf.&lt;/SPAN&gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;This should work just as well, and probably what you want. If you check for the existence or to use myfile that will not exist with the above code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let filrf=myfile;
%let rc=%sysfunc(filename(&amp;amp;filrf, physical-filename));

%if &amp;amp;rc ne 0 %then
	%put %sysfunc(sysmsg());
%let rc=%sysfunc(filename(&amp;amp;filrf));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Jun 2018 20:43:46 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-06-18T20:43:46Z</dc:date>
    <item>
      <title>argument in filename()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/argument-in-filename/m-p/471225#M120678</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why the ampersand (&amp;amp;) is not required&amp;nbsp; for macro variable filrf in this example ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let filrf=myfile;
%let rc=%sysfunc(filename(filrf, physical-filename));

%if &amp;amp;rc ne 0 %then
	%put %sysfunc(sysmsg());
%let rc=%sysfunc(filename(filrf));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Jun 2018 20:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/argument-in-filename/m-p/471225#M120678</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2018-06-18T20:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: argument in filename()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/argument-in-filename/m-p/471227#M120680</link>
      <description>&lt;P&gt;Because filerf is the name you passed to the filename reference to create the reference. If you used the ampersand in both cases it works as well. That's the key - use it both or don't use it both.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; filrf&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;myfile&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; rc&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token macrostatement"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;filrf&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; physical&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;; &amp;lt;- if this was &amp;amp;filrf you need it in the next step as well. If not, it's the string filrf.&lt;/SPAN&gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;This should work just as well, and probably what you want. If you check for the existence or to use myfile that will not exist with the above code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let filrf=myfile;
%let rc=%sysfunc(filename(&amp;amp;filrf, physical-filename));

%if &amp;amp;rc ne 0 %then
	%put %sysfunc(sysmsg());
%let rc=%sysfunc(filename(&amp;amp;filrf));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Jun 2018 20:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/argument-in-filename/m-p/471227#M120680</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-18T20:43:46Z</dc:date>
    </item>
  </channel>
</rss>

