<?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: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575989#M162990</link>
    <description>&lt;P&gt;Hi Kurt, Thank you, that almost worked perfectly. But instead of just deleting the files, it also deleted the entire folder. In addition, for some reason, my macro didn't stop after reaching the last file and kept going...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro loop;&lt;BR /&gt;%if &amp;amp;n %then&lt;BR /&gt;%do;&lt;BR /&gt;%do i=1 %to &amp;amp;n;&lt;BR /&gt;%let filein=%scan(&amp;amp;filename,&amp;amp;i,'|');&lt;BR /&gt;%PUT filein=&amp;amp;filein;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;fname="fileref";&lt;BR /&gt;rc=filename(fname,"&amp;amp;path1.&amp;amp;filein.");&lt;BR /&gt;if rc = 0 and fileexist("&amp;amp;path1./&amp;amp;filein.") then&lt;BR /&gt;rc=fdelete(fname);&lt;BR /&gt;rc=filename(fname);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%loop;&lt;/P&gt;&lt;P&gt;filein=SUBJECT9202.csv&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;filein=SUBJECT7829.csv&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;filein=&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;filein=&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2019 21:42:22 GMT</pubDate>
    <dc:creator>kmardinian</dc:creator>
    <dc:date>2019-07-23T21:42:22Z</dc:date>
    <item>
      <title>NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575980#M162985</link>
      <description>&lt;P&gt;I am trying to delete files from a folder by using the FDELETE statement. But I keep getting this note that my file exceeds 8 characters and will be truncated and then they are not deleted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro loop;&lt;BR /&gt;%if &amp;amp;n %then&lt;BR /&gt;%do;&lt;BR /&gt;%do i=1 %to &amp;amp;n;&lt;BR /&gt;%let filein=%scan(&amp;amp;filename,&amp;amp;i,'|');&lt;BR /&gt;%PUT filein=&amp;amp;filein;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;fname="&amp;amp;filein";&lt;BR /&gt;rc=filename(fname,"&amp;amp;path1");&lt;BR /&gt;if rc = 0 and fileexist(fname) then&lt;BR /&gt;rc=fdelete(fname);&lt;BR /&gt;rc=filename(fname);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%loop;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG:&lt;/P&gt;&lt;P&gt;filein=SUBJECT213453.csv&lt;/P&gt;&lt;P&gt;NOTE: In a call to the FDELETE routine, the fileref C:\Users\K.M\Desktop\SUBJECT213453.csv exceeds 8&lt;BR /&gt;characters, and will be truncated.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 20:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575980#M162985</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-07-23T20:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575982#M162986</link>
      <description>&lt;P&gt;Sorry the path1 should be this instead C:\Users\K.M\Desktop\Reads\SUBJECT213453.csv;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But even with this fixed, I am still getting the same NOTE&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 21:05:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575982#M162986</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-07-23T21:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575986#M162987</link>
      <description>&lt;P&gt;FNAME is an alias of no more than 8 characters that points to the the actual file name, not the actual file name itself as you have assigned it.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 21:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575986#M162987</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-07-23T21:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575987#M162988</link>
      <description>&lt;P&gt;You are using a physical filename in a place where you need a valid SAS name of maximal 8 characters.&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;fname="fileref";
rc=filename(fname,"&amp;amp;path1./&amp;amp;filein.");
if rc = 0 and fileexist("&amp;amp;path./&amp;amp;filein.") then&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 21:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575987#M162988</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-23T21:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575989#M162990</link>
      <description>&lt;P&gt;Hi Kurt, Thank you, that almost worked perfectly. But instead of just deleting the files, it also deleted the entire folder. In addition, for some reason, my macro didn't stop after reaching the last file and kept going...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro loop;&lt;BR /&gt;%if &amp;amp;n %then&lt;BR /&gt;%do;&lt;BR /&gt;%do i=1 %to &amp;amp;n;&lt;BR /&gt;%let filein=%scan(&amp;amp;filename,&amp;amp;i,'|');&lt;BR /&gt;%PUT filein=&amp;amp;filein;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;fname="fileref";&lt;BR /&gt;rc=filename(fname,"&amp;amp;path1.&amp;amp;filein.");&lt;BR /&gt;if rc = 0 and fileexist("&amp;amp;path1./&amp;amp;filein.") then&lt;BR /&gt;rc=fdelete(fname);&lt;BR /&gt;rc=filename(fname);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%loop;&lt;/P&gt;&lt;P&gt;filein=SUBJECT9202.csv&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;filein=SUBJECT7829.csv&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;filein=&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;filein=&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 21:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/575989#M162990</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-07-23T21:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576005#M162995</link>
      <description>&lt;P&gt;why not just do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint ;
select 'drop table '||memname into :empties separated by ';'
from dictionary.tables
where libname='WORK' and nobs=0
;
&amp;amp;empties;
quit;

%let empties=;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2019 00:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576005#M162995</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-07-24T00:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576008#M162996</link>
      <description>&lt;P&gt;(Can you post your code using the Insert SAS Code icon???)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this would be related to&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Pulling-files-from-an-output-folder-without-knowing-the-file/td-p/575446" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Pulling-files-from-an-output-folder-without-knowing-the-file/td-p/575446&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some sample code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* create 10 CSV files ***having the same format*** ;
%let pathname=%sysfunc(pathname(work));
%macro code;
   %do i=1 %to 10;
      %let i=%sysfunc(putn(&amp;amp;i,z2.));
      proc export data=sashelp.class dbms=csv outfile="&amp;amp;pathname\class&amp;amp;i..csv";
      run;
   %end;
%mend;
%code;

* check created file ;
data _null_;
   infile "&amp;amp;pathname\class01.csv";
   input;
   put _infile_;
run;

* build a directory list ;
%dirlist(dir=&amp;amp;pathname, filter=ext='csv')

* check dirlist ;
proc print data=dirlist;
run;

* read each file ;
%macro code;
%let fullname=%sysfunc(strip(&amp;amp;fullname));
data WORK.TEMP;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile "&amp;amp;fullname" delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2;
   informat Name $7. ;
   informat Sex $1. ;
   informat Age best32. ;
   informat Height best32. ;
   informat Weight best32. ;
   format Name $7. ;
   format Sex $1. ;
   format Age best12. ;
   format Height best12. ;
   format Weight best12. ;
input
            Name $
            Sex $
            Age
            Height
            Weight
;
if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
run;

proc append data=work.temp base=work.want;
run;
%mend;

* delete base table from previous runs ;
%kill(data=work.want)

* call code macro for every row in dirlist ;
%loop_control(control=dirlist)

* check final table ;
proc print data=want;
run;

* delete the CSVs ;
%macro code;
   %let fullname=%sysfunc(strip(&amp;amp;fullname));
   %let rc=%sysfunc(filename(________,&amp;amp;fullname));
   %if (&amp;amp;rc eq 0 and %sysfunc(fexist(________)) eq 1) %then %do;
      %let rc=%sysfunc(fdelete(________));
      %if (&amp;amp;rc eq 0) %then 
         %put &amp;amp;fullname deleted.;
      %else
         %put &amp;amp;fullname was not deleted.;
   %end;
   %let rc=%sysfunc(filename(________));
%mend;

%macro code;
   %let fullname=%sysfunc(strip(&amp;amp;fullname));
   data _null_;
      rc=filename("________","&amp;amp;fullname");
      if (rc eq 0 and fexist("________")) then do;
         rc=fdelete("________");
         if (rc eq 0) then
            putlog "&amp;amp;fullname was deleted.";
         else
            putlog "&amp;amp;fullname was not deleted.";
      end;
      rc=filename("________");
   run;
%mend;
%loop_control(control=dirlist)

* check the results (should be empty dataset) ;
%dirlist(dir=&amp;amp;pathname, filter=ext='csv')
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, now I'll hijack your post &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp; (temporarily)...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I often like a "pure macro" solution when possible (or if it makes sense).&amp;nbsp; So, does anyone know why the first delete files macro fails?&amp;nbsp; I know it's due to the fexist function, I just don't see why it's returning 0 instead of 1?&amp;nbsp; The second data step macro works, and does delete the CSV files.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 00:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576008#M162996</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-24T00:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576010#M162997</link>
      <description>&lt;P&gt;Hi, I am trying to understand how your proc sql statement works and is calling my files?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 00:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576010#M162997</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-07-24T00:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576011#M162998</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;&amp;nbsp;wrote:
&lt;P class="1563927622999"&gt;&amp;nbsp;&lt;/P&gt;
However, now I'll hijack your post &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp; (temporarily)...
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I often like a "pure macro" solution when possible (or if it makes sense).&amp;nbsp; So, does anyone know why the first delete files macro fails?&amp;nbsp; I know it's due to the fexist function, I just don't see why it's returning 0 instead of 1?&amp;nbsp; The second data step macro works, and does delete the CSV files.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've found the answer:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000210817.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000210817.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you look &lt;FONT size="4" color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;very closely&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt; at the example (which doesn't make clear that &amp;amp;fref isn't an already existing macro variable):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%if %sysfunc(fexist(&lt;FONT size="7" color="#FF0000"&gt;&lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt;&lt;/FONT&gt;fref)) %then
      %put The file identified by the fileref
         &amp;amp;fref exists.;
   %else
      %put %sysfunc(sysmsg());&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Changing this to open 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 rc=%sysfunc(filename(foo,G:\SAS\Work\_TD7752_MYSERVERNAME_\Prc2\class01.csv));
%put &amp;amp;=rc;
%let rc=%sysfunc(fexist(foo));  * fails ;
%put &amp;amp;=rc;
%let rc=%sysfunc(fexist(&amp;amp;foo));  * works ;
%put &amp;amp;=rc;
&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;So, macro variable &amp;amp;foo does not exist, yes that's the syntax required for the fexist function (when called via %sysfunc)???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What genius came up with this syntax?&amp;nbsp; Or am I missing something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you make this change to my previous code, the "all macro" version of %code works and deletes the CSV files:&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;* delete the CSVs ;
%macro code;
   %let fullname=%sysfunc(strip(&amp;amp;fullname));
   %let rc=%sysfunc(filename(________,&amp;amp;fullname));
   %if (&amp;amp;rc eq 0 and %sysfunc(fexist(&lt;FONT size="7" color="#FF0000"&gt;&amp;amp;&lt;/FONT&gt;________)) eq 1) %then %do;
      %let rc=%sysfunc(fdelete(&lt;FONT size="7" color="#FF0000"&gt;&amp;amp;&lt;/FONT&gt;________));
      %if (&amp;amp;rc eq 0) %then 
         %put &amp;amp;fullname deleted.;
      %else
         %put &amp;amp;fullname was not deleted.;
   %end;
   %let rc=%sysfunc(filename(________));
%mend;
%loop_control(control=dirlist)&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;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000210817.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000210817.htm&amp;nbsp; (fexist)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245893.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245893.htm&lt;/A&gt;&amp;nbsp; (fdelete - no macro example in the doc.&amp;nbsp; fdelete also needs the bogus ampersand.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I checked to see if the 9.4 documentation was updated:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n058nguffapu6sn11ujbnco8ohrf.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n058nguffapu6sn11ujbnco8ohrf.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The "example" makes no sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#p029yvwyao7xspn19xzxo3vyb0hz.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#p029yvwyao7xspn19xzxo3vyb0hz.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;No examples at all.&amp;nbsp; Seems like the documentation is regressing!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 00:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576011#M162998</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-24T00:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576012#M162999</link>
      <description>&lt;P&gt;Huh?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The FEXIST() function takes as input the FILEREF of the file to be tested. You can just type the fileref or put the fileref into a macro variable and expand the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you try to reference a macro variable that doesn't exist then you will pass the FEXIST() a string with an &amp;amp; in it, which is an impossible value for a FILEREF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576012#M162999</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T01:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576017#M163001</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Huh?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The FEXIST() function takes as input the FILEREF of the file to be tested. You can just type the fileref or put the fileref into a macro variable and expand the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you try to reference a macro variable that doesn't exist then you will pass the FEXIST() a string with an &amp;amp; in it, which is an impossible value for a FILEREF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yeah, I said "Huh?" myself, but not for the same reason as you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the code I posted.&amp;nbsp; It's self-contained, you can just paste it into SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&amp;nbsp; Actually, not really, you'll need some macros from&amp;nbsp;&lt;A href="https://github.com/scottbass/SAS/tree/master/Macro" target="_blank"&gt;https://github.com/scottbass/SAS/tree/master/Macro&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fileref I used was 8 underscores, which more than likely won't clobber an existing fileref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code only works properly when I specify &amp;amp;________ for fexist and fdelete.&amp;nbsp; That macro variable does not exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, SAS 9.3 on Windows.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576017#M163001</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-24T01:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576018#M163002</link>
      <description>&lt;P&gt;Perhaps the issue is somewhere else in the code?&lt;/P&gt;
&lt;P&gt;This works fine with a fileref of 8 underscores.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let fileref=________;
filename &amp;amp;fileref temp;

%put Does &amp;amp;fileref exist?  %sysfunc(fexist(&amp;amp;fileref)) ;
%put Does ________ exist? %sysfunc(fexist(________)) ;

data _null_;
  file ________;
  put 'Hello';
run;

%put Does &amp;amp;fileref exist?  %sysfunc(fexist(&amp;amp;fileref)) ;
%put Does ________ exist? %sysfunc(fexist(________)) ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576018#M163002</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T01:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576019#M163003</link>
      <description>&lt;P&gt;The FILENAME() function is probably your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 class="xis-argument"&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;fileref&lt;/SPAN&gt;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;specifies the fileref to assign to the external file. In a DATA step,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;fileref&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;can be a character expression, a string enclosed in single quotation marks that specifies the fileref, or a DATA step variable whose value contains the fileref.&lt;FONT color="#FF0000"&gt; In a macro (for example, in the %SYSFUNC function),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;fileref&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is the name of a macro variable (without an ampersand) whose value contains the fileref to assign to the external file.&lt;/FONT&gt; If the function is used within a DATA step, the fileref must be enclosed in single quotation marks. If the function is used in macro code, the fileref must not be enclosed in quotation marks.&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;If you want to use the FILENAME() function to create filref of FRED the set a macro variable to the value FRED and pass the NAME of the macro to FILENAME() function.&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let fileref=________;
%let rc1=%sysfunc(filename(fileref,"my physical file"));
%let rc2=%sysfunc(fexist(&amp;amp;fileref));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or leave the macro variable empty and the FILENAME() function will make up a fileref name for you.&lt;/P&gt;
&lt;PRE&gt;704   %let fileref=;
705   %let rc=%sysfunc(filename(fileref,"C:\download\does no exist"));
706   %put &amp;amp;=fileref Does it Exist? %sysfunc(fexist(&amp;amp;fileref)) ;
FILEREF=#LN00196 Does it Exist? 0&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576019#M163003</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T01:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576021#M163005</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* create file ;
filename foo "%sysfunc(pathname(work))\foo.csv";
data _null_;
   file foo;
   put 'blah blah blah';;
run;
filename foo;

* delete file using macro code ;
%let rc=%sysfunc(filename(________,%sysfunc(pathname(work))\foo.csv)); * works ;
%put &amp;amp;=rc;

%let exists=%sysfunc(fexist(________)); * fails, returns 0 not 1 ;
%put &amp;amp;=exists;
%let rc=%sysfunc(fdelete(________));  * fails, does not delete file ; ;
%put &amp;amp;=rc;

%let exists=%sysfunc(fexist(&amp;amp;________)); * works, returns 1, even though macro variable &amp;amp;foo does not exist ;
%put &amp;amp;=exists;
%let rc=%sysfunc(fdelete(&amp;amp;________));  * works, deletes file ;
%put &amp;amp;=rc;

%let rc=%sysfunc(filename(________));
%put &amp;amp;=rc;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And my SAS log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;27         * create file ;
28         filename foo "%sysfunc(pathname(work))\foo.csv";
29         data _null_;
30            file foo;
31            put 'blah blah blah';;
32         run;

NOTE: The file FOO is:
      Filename=G:\SAS\Work\_TD8076_XXXXXXXX_\Prc2\foo.csv,
      RECFM=V,LRECL=256,File Size (bytes)=0,
      Last Modified=24 July 2019 11:49:24,
      Create Time=24 July 2019 11:49:24

NOTE: 1 record was written to the file FOO.
      The minimum record length was 14.
      The maximum record length was 14.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

33         filename foo;
NOTE: Fileref FOO has been deassigned.
34         
35         * delete file using macro code ;
36         %let rc=%sysfunc(filename(________,%sysfunc(pathname(work))\foo.csv)); * works ;
37         %put &amp;amp;=rc;
RC=0
38         
39         %let exists=%sysfunc(fexist(________)); * fails, returns 0 not 1 ;
40         %put &amp;amp;=exists;
EXISTS=0
41         %let rc=%sysfunc(fdelete(________));  * fails, does not delete file ; ;
42         %put &amp;amp;=rc;
RC=20004
43         
44         %let exists=%sysfunc(fexist(&amp;amp;________)); * works, returns 1, even though macro variable &amp;amp;________ does not exist ;
45         %put &amp;amp;=exists;
EXISTS=1
46         %let rc=%sysfunc(fdelete(&amp;amp;________));  * works, deletes file, even though macro variable &amp;amp;________ does not exist ;
47         %put &amp;amp;=rc;
RC=0
48         
49         %let rc=%sysfunc(filename(________));
50         %put &amp;amp;=rc;
RC=0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I admit it's weird, and perhaps I'm missing something, but I don't get it...&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:52:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576021#M163005</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-24T01:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576022#M163006</link>
      <description>&lt;P&gt;You told FILENAME() to use the MACRO VARIABLE named ________.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 01:53:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576022#M163006</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-24T01:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576023#M163007</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still contend that SAS R&amp;amp;D could have made the syntax better when invoking filename/fexist/fdelete via %sysfunc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do I need to create a macro variable for the fileref parameter to filename, instead of just entering the text that the macro variable would contain (like everywhere else in SAS)?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps if I don't specify a macro variable as the parameter to the filename function(contrary to the documentation, as you pointed out), the filename function creates &amp;amp;________?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still contend poor syntax and poor documentation, but thanks for clarifying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Yeah, see here.&amp;nbsp; Again, the doc could be clearer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* create file ;
filename foo "%sysfunc(pathname(work))\foo.csv";
data _null_;
   file foo;
   put 'blah blah blah';;
run;
filename foo;

* delete file using macro code ;
%let rc=%sysfunc(filename(________,%sysfunc(pathname(work))\foo.csv)); * works ;
%put &amp;amp;=rc;
&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;%put &amp;amp;=________;  * &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; ;&lt;/FONT&gt;&lt;/STRONG&gt;

%let exists=%sysfunc(fexist(________)); * fails, returns 0 not 1 ;
%put &amp;amp;=exists;
%let rc=%sysfunc(fdelete(________));  * fails, does not delete file ; ;
%put &amp;amp;=rc;

%let exists=%sysfunc(fexist(&amp;amp;________)); * works, returns 1, even though macro variable &amp;amp;foo does not exist ;
%put &amp;amp;=exists;
%let rc=%sysfunc(fdelete(&amp;amp;________));  * works, deletes file ;
%put &amp;amp;=rc;

%let rc=%sysfunc(filename(________));
%put &amp;amp;=rc;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2019 02:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576023#M163007</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-24T02:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576024#M163008</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You told FILENAME() to use the MACRO VARIABLE named ________.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which did not exist (I started a fresh SAS session), yet "worked" (no unresolved macro variable warning), THEN created &amp;amp;________ (AFAIK undocumented behaviour).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, I didn't mean to hijack&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139341"&gt;@kmardinian&lt;/a&gt;&amp;nbsp;post.&amp;nbsp; PM me to discuss further &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 02:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576024#M163008</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-24T02:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576025#M163009</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;In a macro (for example, in the %SYSFUNC function),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;fileref&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is the name of a macro variable (without an ampersand) whose value contains the fileref to assign to the external file.&lt;/FONT&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that's why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;&amp;nbsp;got his knickers in a twist.&lt;/P&gt;
&lt;P&gt;There are very few cases where one can access the value of a macro variable without using ampersand. I can think of symget() and %superq().&lt;/P&gt;
&lt;P&gt;Why the filename() function was implemented this way seems atypical indeed.&lt;/P&gt;
&lt;P&gt;It's probably so that "discardable" names such as #LN00196 can be created transparently, in a manner similar to the TEMP device, as shown in the common examples of this function being used in the macro language:&lt;/P&gt;
&lt;PRE&gt;%let fileref=;
%let rc=%sysfunc(filename(fileref,&amp;amp;path));&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 02:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576025#M163009</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-24T02:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576028#M163011</link>
      <description>&lt;PRE&gt;%macro loop;
	%if &amp;amp;n %then
		%do;
			%do i=1 %to &amp;amp;n;
				%let filein=%scan(&amp;amp;filename,&amp;amp;i,'|');
				%PUT filein=&amp;amp;filein;

data test;
fname = "StudyID";
rc=filename(fname,"&amp;amp;path1.&amp;amp;filein");
if rc = 0 and fileexist("path1./&amp;amp;filein.") then
rc=fdelete(fname);
rc=filename(fname);
run;


			%end;

		%end;
%mend;

%loop;&lt;/PRE&gt;&lt;P&gt;Hi Kurt, when you say a valid SAS name, is this a SAS variable that is located in the csv files or just any 8 character name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have so far, but it still is not deleting the files in the appropriate folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 03:25:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576028#M163011</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-07-24T03:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: NOTE: In a call to the FDELETE routine, the fileref ' ' exceeds 8 characters and will be truncat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576035#M163012</link>
      <description>&lt;P&gt;1. Read the documentation about the functions you use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You don't need a macro at all:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%* PREPARE DATA; 
data _null_;
  file 'c:\temp\b.csv'; 
  put 'a'; 
run;

%let n        = 2;
%let filenames= a.csv | b.csv;
%let path1    = c:\temp\ ;

%* DELETE FILES;
data _null_;
  do I=1 to &amp;amp;n;
    FILENAME=cats("&amp;amp;path1",scan("&amp;amp;filenames",I,'|'));  
    if ^fileexist(FILENAME) then continue;
    RC=filename("StudyID",FILENAME);
    if RC=0 then RC=fdelete("StudyID");
  end;
  RC=filename("StudyID");
run;

&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 05:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/NOTE-In-a-call-to-the-FDELETE-routine-the-fileref-exceeds-8/m-p/576035#M163012</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-24T05:40:38Z</dc:date>
    </item>
  </channel>
</rss>

