<?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: &amp;quot;A component of ... is not a directory&amp;quot; error when exporting multiple sheets using ODS in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691545#M24578</link>
    <description>Thank you! This works. This was clearly a Stata user error.</description>
    <pubDate>Wed, 14 Oct 2020 14:26:52 GMT</pubDate>
    <dc:creator>Zoe8SAS</dc:creator>
    <dc:date>2020-10-14T14:26:52Z</dc:date>
    <item>
      <title>"A component of ... is not a directory" error when exporting multiple sheets using ODS EXCEL</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691430#M24574</link>
      <description>&lt;P&gt;I have a cross-sectional dataset with one observation of a integer variable for each individual. Individuals belong to 3 groups. I want to get the frequency distribution of the integer variable across individuals separately for each group and export the results to one Excel file (called FILENAME) with one sheet for each group. I use ODS EXCEL .&lt;/P&gt;&lt;P&gt;Results for the first group export without issues, but the second group produces the following error:&lt;/P&gt;&lt;P&gt;"A component of PATHNAME\FILENAME.xlsx&amp;nbsp;is not a directory.&amp;nbsp;ERROR: No body file. EXCEL output will not be created." where PATHNAME is the path for the folder where I want to save the Excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a simple example with a SAS Help dataset:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
set 	sashelp.Class;
run;

*Female;
ods excel file="PATHNAME\test.xlsx" 
	options(sheet_name="Female" 
			embedded_titles="yes"
			embed_titles_once="yes");


proc freq data = test(where=(sex="F"));
	label Age='Age at survey';
	tables age;
	title "Age at survey for female participants";
run;


*Male;
ods excel file="PATHNAME\test.xlsx" 
	options(sheet_name="Male" 
			embedded_titles="yes"
			embed_titles_once="yes");


proc freq data = test(where=(sex="M"));
	label Age='Age at survey';
	tables age;
	title "Age at survey for male participants";
run;

ods excel close;	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The sheet for female individuals exports without issues, but the sheet for male individuals generates the following error right after the ODS EXCEL statement and before the PROC FREQ statement:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: A component of PATHNAME\test.xlsx is not a directory.&lt;BR /&gt;ERROR: No body file. EXCEL output will not be created.&lt;BR /&gt;NOTE: Writing EXCEL file: S:\Projects\COVID19_ESPI\Community Cohort\3_Output\Non_response\test.xlsx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I solve this issue?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I saw that for exporting html files defining the path and file separately can work. However, ods excel does not seem to support that option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 23:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691430#M24574</guid>
      <dc:creator>Zoe8SAS</dc:creator>
      <dc:date>2020-10-13T23:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: "A component of ... is not a directory" error when exporting multiple sheets using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691433#M24575</link>
      <description>&lt;P&gt;You only need to give the file name once.&amp;nbsp; Just delete&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;file="PATHNAME\test.xlsx" &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;from the second ODS call.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 00:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691433#M24575</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-10-14T00:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: "A component of ... is not a directory" error when exporting multiple sheets using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691494#M24576</link>
      <description>&lt;UL&gt;
&lt;LI&gt;Specify the filename and initial option settings in the first ODS EXCEL FILE=... OPTIONS(...) statement&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="font-family: inherit;"&gt;Change active option settings with an ODS EXCEL OPTIONS(...) statement&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Example coding template&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;ods EXCEL
  file="PATHNAME\test.xlsx" 
  options(embedded_titles="yes" embed_titles_once="yes")
;

ods EXCEL options(sheet_name="Female");
...
run;

ods EXCEL options(sheet_name="Male");
...
run;

ods EXCEL close;
&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;I would agree the &lt;EM&gt;is not a directory&amp;nbsp;&lt;/EM&gt;ERROR is quite obtuse and could be better stated as "ERROR: The ODS EXCEL destination is already open"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;NOTE: You can have multiple destinations open at once if your name your destinations.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;ODS EXCEL(boss) file="...boss.xlsx";
ODS EXCEL(qa) file="...qa.xlsx";
ODS HTML file="...general.html";

... code block 1 ...
ODS EXCEL(boss) CLOSE;
... code block 2 ...
ODS HTML CLOSE;
... code block 3 ...
ODS EXCEL(qa) CLOSE;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 10:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691494#M24576</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-10-14T10:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: "A component of ... is not a directory" error when exporting multiple sheets using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691545#M24578</link>
      <description>Thank you! This works. This was clearly a Stata user error.</description>
      <pubDate>Wed, 14 Oct 2020 14:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691545#M24578</guid>
      <dc:creator>Zoe8SAS</dc:creator>
      <dc:date>2020-10-14T14:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: "A component of ... is not a directory" error when exporting multiple sheets using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691546#M24579</link>
      <description>Thanks for this detailed response! This works.</description>
      <pubDate>Wed, 14 Oct 2020 14:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-A-component-of-is-not-a-directory-quot-error-when-exporting/m-p/691546#M24579</guid>
      <dc:creator>Zoe8SAS</dc:creator>
      <dc:date>2020-10-14T14:27:14Z</dc:date>
    </item>
  </channel>
</rss>

