<?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: Export to Excel - Excel file get deleted in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548570#M152124</link>
    <description>&lt;P&gt;Thank you all for helping.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
    <pubDate>Thu, 04 Apr 2019 17:11:58 GMT</pubDate>
    <dc:creator>hhchenfx</dc:creator>
    <dc:date>2019-04-04T17:11:58Z</dc:date>
    <item>
      <title>Export to Excel - Excel file get deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548273#M152019</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I export to Excel using Proc Report and then export few more sheets as below.&lt;/P&gt;
&lt;P&gt;If I rung the Proc Report till&amp;nbsp;ods excel close; Excel file will open.&lt;/P&gt;
&lt;P&gt;After I close Excel file and run the second part, the whole Excel file that contain Proc Report's result is deleted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me to fix the problem?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;HHCFX&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;&lt;BR /&gt;&lt;BR /&gt;*PART1==============================================================================;&lt;BR /&gt;
ods listing close;
ods excel file="&amp;amp;export_folder\Allocation_&amp;amp;export_name..xlsx"   
                    options ( sheet_interval = "none" sheet_name = "cost_by_company" );

ods excel options (sheet_interval = "proc" sheet_name = "cost_by_project");		
	proc report data=cost_by_project nowd
		STYLE(Header)={background=CYAN foreground=black font_face="Calibri" font_size=12pt}		/*top row*/
     	style(column)={font_face="Calibri" font_size=11pt};
			define N/order noprint;

			compute N  ;
	IF mod(N,4)=1 then call define(_row_,'style','style={background=LIGY}'); ELSE
	IF mod(N,4)=2 then call define(_row_,'style','style={background=PWH}'); 
			endcomp;
		run;
ods excel close;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;*PART2==============================================================================;&lt;BR /&gt;
*export for checking purpose;
	proc export data=_user_prj_hour_check dbms=xlsx 
	outfile="&amp;amp;export_folder\Allocation_&amp;amp;export_name..xlsx" replace; 
	sheet="CHECK_user_project";;run;

	proc export data=user_hour_check dbms=xlsx 
	outfile="&amp;amp;export_folder\Allocation_&amp;amp;export_name..xlsx" replace; 
	sheet="CHECK_totalhours_with SA";	;run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 18:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548273#M152019</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-04-03T18:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Excel - Excel file get deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548279#M152020</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/49486"&gt;@hhchenfx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;I export to Excel using Proc Report and then export few more sheets as below.&lt;/P&gt;
&lt;P&gt;If I rung the Proc Report till&amp;nbsp;ods excel close; Excel file will open.&lt;/P&gt;
&lt;P&gt;After I close Excel file and run the &lt;FONT color="#FF0000"&gt;second part&lt;/FONT&gt;, the whole Excel file that contain Proc Report's result is deleted.&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What do you mean by "second part"?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 17:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548279#M152020</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-03T17:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Excel - Excel file get deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548298#M152030</link>
      <description>&lt;P&gt;In my original message, I have 2 section of code.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 18:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548298#M152030</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-04-03T18:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Excel - Excel file get deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548404#M152068</link>
      <description>&lt;P&gt;Works fine for me.&amp;nbsp; Are you overwriting one of the sheets generated by the ODS EXCEL output with the PROC EXPORT output?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=c:\downloads;
%let fname=&amp;amp;path\test1.xlsx;

ods excel file="&amp;amp;fname"  ;
proc print data=sashelp.class;
run;
ods excel close;

proc export data=sashelp.class 
  dbms=xlsx file="&amp;amp;fname" replace ;
  sheet="export";
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Apr 2019 04:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548404#M152068</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-04T04:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Excel - Excel file get deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548414#M152074</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;works for me too:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let export_folder=C:\;
%let export_name=Table1;
*PART1==============================================================================;
   ods listing close;
   ods excel file="&amp;amp;export_folder\Allocation_&amp;amp;export_name..xlsx"   
                       options ( sheet_interval = "none" sheet_name = "cost_by_company" );

   ods excel options (sheet_interval = "proc" sheet_name = "cost_by_project");		
   	proc report data=sashelp.class nowd
   		STYLE(Header)={background=CYAN foreground=black font_face="Calibri" font_size=12pt}		/*top row*/
        	style(column)={font_face="Calibri" font_size=11pt};
   			define age/order noprint;

   			compute age  ;
   	IF mod(age,4)=1 then call define(_row_,'style','style={background=LIGY}'); ELSE
   	IF mod(age,4)=2 then call define(_row_,'style','style={background=PWH}'); 
   			endcomp;
   		run;
   ods excel close;

*PART2==============================================================================;
*export for checking purpose;

	proc export data=sashelp.cars dbms=xlsx 
	outfile="&amp;amp;export_folder\Allocation_&amp;amp;export_name..xlsx" replace; 
	sheet="CHECK_user_project";;run;

	proc export data=sashelp.demographics dbms=xlsx 
	outfile="&amp;amp;export_folder\Allocation_&amp;amp;export_name..xlsx" replace; 
	sheet="CHECK_totalhours_with SA";	;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Apr 2019 06:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548414#M152074</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2019-04-04T06:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Excel - Excel file get deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548416#M152075</link>
      <description>&lt;P&gt;Please post the value of the automatic macro-variable SysVLong.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=SysVLong;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Writes the value to the log.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 06:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548416#M152075</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-04-04T06:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Excel - Excel file get deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548570#M152124</link>
      <description>&lt;P&gt;Thank you all for helping.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 17:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-Excel-Excel-file-get-deleted/m-p/548570#M152124</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-04-04T17:11:58Z</dc:date>
    </item>
  </channel>
</rss>

