<?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: ERROR: Physical file does not exist when using a Wildcard in Filename Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Physical-file-does-not-exist-when-using-a-Wildcard-in/m-p/741171#M231657</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;BR /&gt;Please remove the single quotes from macro definitions. Have them as shown below.&lt;/P&gt;
&lt;P&gt;Macro variable includes everything from the equal to sign and semi colon.&lt;/P&gt;
&lt;PRE&gt;%let location = C:\Users\1\Desktop\; &lt;BR /&gt;%let file = Reference_Report;&lt;BR /&gt;%let extension =.xlsx;&lt;BR /&gt;%let filename = &amp;amp;location&amp;amp;file&amp;amp;extension;&lt;BR /&gt;%put &amp;amp;=filename;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 May 2021 16:47:12 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2021-05-13T16:47:12Z</dc:date>
    <item>
      <title>ERROR: Physical file does not exist when using a Wildcard in Filename Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Physical-file-does-not-exist-when-using-a-Wildcard-in/m-p/741167#M231654</link>
      <description>&lt;P&gt;I have an excel file report name Reference_Report. The file name ends with a time stamp every time it is exported to my machine.&lt;BR /&gt;My library reference the report in my desktop. Instead of updating the file name, I thought I would use a wild card. When I run the code SAS gives me&amp;nbsp;ERROR: Physical file does not exist, C:\WINDOWS\system32\FILENAME.xlsx&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Ref 'C:\Users\1\Desktop\';

%let location = 'C:\Users\1\Desktop\'; 
%let file = 'Reference_Report';
%let extension ='.xlsx';
%let filename = &amp;amp;location&amp;amp;file*&amp;amp;extension;

proc import 
datafile = filename
out = Ref.Report1
dbms = xlsx
replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 16:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Physical-file-does-not-exist-when-using-a-Wildcard-in/m-p/741167#M231654</guid>
      <dc:creator>marathoner</dc:creator>
      <dc:date>2021-05-13T16:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Physical file does not exist when using a Wildcard in Filename Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Physical-file-does-not-exist-when-using-a-Wildcard-in/m-p/741171#M231657</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;BR /&gt;Please remove the single quotes from macro definitions. Have them as shown below.&lt;/P&gt;
&lt;P&gt;Macro variable includes everything from the equal to sign and semi colon.&lt;/P&gt;
&lt;PRE&gt;%let location = C:\Users\1\Desktop\; &lt;BR /&gt;%let file = Reference_Report;&lt;BR /&gt;%let extension =.xlsx;&lt;BR /&gt;%let filename = &amp;amp;location&amp;amp;file&amp;amp;extension;&lt;BR /&gt;%put &amp;amp;=filename;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 16:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Physical-file-does-not-exist-when-using-a-Wildcard-in/m-p/741171#M231657</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-13T16:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Physical file does not exist when using a Wildcard in Filename Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Physical-file-does-not-exist-when-using-a-Wildcard-in/m-p/741172#M231658</link>
      <description>&lt;P&gt;First thing you did not reference your "filename" macro variable.Should look like:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;proc import 
datafile = &amp;amp;filename.
out = Ref.Report1
dbms = xlsx
replace;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second your "filename" will be built incorrectly. By placing quote characters in the Location,File and Extension variables your Filename is: 'C:\Users\1\Desktop\''Reference_Report'*'.xlsx'&lt;/P&gt;
&lt;P&gt;Which has two single quotes in the middle and other extra quotes. If you want to generate 'C:\Users\1\Desktop\Reference_Report*.xlsx'&lt;/P&gt;
&lt;P&gt;You need different code.&lt;/P&gt;
&lt;PRE&gt;%let location = C:\Users\1\Desktop\; 
%let file = Reference_Report;
%let extension =.xlsx;
%let filename = "&amp;amp;location.&amp;amp;file.*&amp;amp;extension.";
 %put &amp;amp;filename.;&lt;/PRE&gt;
&lt;P&gt;Double quotes are used so the macro variables will resolve inside them.&lt;/P&gt;
&lt;P&gt;But if you have more than one of the "reference_report.xlsx" files in that folder proc import will choke on that as it doesn't deal with multiple input files.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 16:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Physical-file-does-not-exist-when-using-a-Wildcard-in/m-p/741172#M231658</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-13T16:51:26Z</dc:date>
    </item>
  </channel>
</rss>

