<?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: How to troubleshoot Physical file does not exist? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346028#M79714</link>
    <description>Could you send log please. I dont sure but&lt;BR /&gt;outfile="&amp;amp;xlsfile1" or outfile=&amp;amp;xlsfile1</description>
    <pubDate>Fri, 31 Mar 2017 05:24:37 GMT</pubDate>
    <dc:creator>Yavuz</dc:creator>
    <dc:date>2017-03-31T05:24:37Z</dc:date>
    <item>
      <title>How to troubleshoot Physical file does not exist?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346021#M79709</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;set sashelp.cars;run;
%let xlsfile1 = C:\Users\1558977\Desktop\autocreate\cars.xlsx;

proc export outfile="&amp;amp;xlsfile1" data=cars dbms=xlsx replace;
run; 
quit;

   * This next routine starts the Excel application.   *;
filename cmds dde 'excel|system';
x "'C:\Program Files\Microsoft Office\Office11\excel.exe'";
data _null_;
   x=sleep(3);
run;

data _null_;
   file cmds;
   put '[open("'"&amp;amp;xlsfile1"'")]';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The intent is to open the excel file and save it password protected.&lt;/P&gt;&lt;P&gt;But SAS keeps giving this error:Physical file does not exis, excel|sytem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UPDATE: The error is linked to excel.exe file not found. If I have Excel running already, the code works fine. So need to search for that excel.exe.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data cars;set sashelp.class;run;
%let xlsfile1 = C:\Users\1558977\Desktop\autocreate\cars.xls;
%let xlsfile2 = C:\Users\1558977\Desktop\autocreate\carspassword.xls;

proc export outfile="&amp;amp;xlsfile1" data=cars dbms=xls replace;
run; 
quit;

* This next routine starts the Excel application.   *;
filename cmds dde 'excel|system';

data _null_ ;
	file cmds;
	put '[open("'"&amp;amp;xlsfile1"'")]';
	put '[SAVE()]';
	put '[Save.as("'"&amp;amp;xlsfile2"'",1,"'"test"'")]';
	PUT '[FILE-CLOSE()]';
run;&lt;/PRE&gt;&lt;P&gt;I've amended by deleting the point towards excel.exe. But for this to work, it requires Excel to be opened first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 08:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346021#M79709</guid>
      <dc:creator>afiqcjohari</dc:creator>
      <dc:date>2017-03-31T08:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to troubleshoot Physical file does not exist?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346028#M79714</link>
      <description>Could you send log please. I dont sure but&lt;BR /&gt;outfile="&amp;amp;xlsfile1" or outfile=&amp;amp;xlsfile1</description>
      <pubDate>Fri, 31 Mar 2017 05:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346028#M79714</guid>
      <dc:creator>Yavuz</dc:creator>
      <dc:date>2017-03-31T05:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to troubleshoot Physical file does not exist?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346030#M79716</link>
      <description>&lt;P&gt;Does Excel open? What step is it failing at?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens if rather than a macro variable for the open command, you use the full path?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 05:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346030#M79716</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-31T05:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to troubleshoot Physical file does not exist?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346183#M79786</link>
      <description>&lt;P&gt;Post the actual log with the code. Your&amp;nbsp; example has a couple of different opportunities for a file not to exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also are you running in a server environment? If so you may have mulitple other issues such as the paths not being recognized bythe server (causing file not to exist) and that Excel is not available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DDE Excel SAVEAS command wants a file format indicator (you may be using 1 for that in your syntax) that is variable depending ont the file type created such as XLSX or XLS (different formats) &lt;STRONG&gt;and depends&lt;/STRONG&gt; on the version of EXCEL doing the saving. For example 56 is to save as an XLS file from Excel 2007-2010. At least in the last working DDE example I have.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 15:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-troubleshoot-Physical-file-does-not-exist/m-p/346183#M79786</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-31T15:31:49Z</dc:date>
    </item>
  </channel>
</rss>

