<?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: Receiving error as Excel file is corrupted after executing the stored procedure through web port in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341211#M5294</link>
    <description>&lt;P&gt;Sorry, its really hard to follow that. &amp;nbsp;Just put some error checking code around the block in question:&lt;/P&gt;
&lt;PRE&gt;%macro do_report (parm=);
  %if &amp;amp;param. ne %then %do;
    ... report set
  %end;
  %else %do;
     ... report blank set
  %end;&lt;BR /&gt;...&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Mar 2017 14:45:47 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-03-15T14:45:47Z</dc:date>
    <item>
      <title>Receiving error as Excel file is corrupted after executing the stored procedure through web portal</title>
      <link>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341169#M5293</link>
      <description>Hello SAS Experts,&lt;BR /&gt;Could any of you please help me out with this issue I'm facing?&lt;BR /&gt;1. I have a SAS stored process created and linked to web portal.&lt;BR /&gt;2. The SAS Stored process is required to generate an Excel file as output comtaining the needed data.&lt;BR /&gt;3. In order to get the desired out , I have to pre process the data with many conditions. Everything is correct whenever I have data in database and giving correct result in Excel.&lt;BR /&gt;&lt;BR /&gt;But the problem comes whenever user gives incorrect input , I have coded it as it will give output in Excel as one record saying " no data available for this input number".&lt;BR /&gt;&lt;BR /&gt;In all other report my logic is throwing this 1 record output in Excel, but in only in 1 report it's not giving desired output like other report.&lt;BR /&gt;&lt;BR /&gt;In my observation, in other report , I just fetch the data using proc SQL and check the record count and if obs=0 then I place a proc report to put 1 record. But in this report as I have to pre process the data , so many datasets get created . And if record does not exist then error found in log , which is I think causing issue .&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Mar 2017 12:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341169#M5293</guid>
      <dc:creator>v9dduhan</dc:creator>
      <dc:date>2017-03-15T12:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error as Excel file is corrupted after executing the stored procedure through web port</title>
      <link>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341211#M5294</link>
      <description>&lt;P&gt;Sorry, its really hard to follow that. &amp;nbsp;Just put some error checking code around the block in question:&lt;/P&gt;
&lt;PRE&gt;%macro do_report (parm=);
  %if &amp;amp;param. ne %then %do;
    ... report set
  %end;
  %else %do;
     ... report blank set
  %end;&lt;BR /&gt;...&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Mar 2017 14:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341211#M5294</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-15T14:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error as Excel file is corrupted after executing the stored procedure through web port</title>
      <link>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341528#M5295</link>
      <description>&lt;P&gt;I used following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = stpsrv_header(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Content-disposition'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'attachment; filename=test.xls'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rc = stpsrv_header(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'Content-disposition'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"inline"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;NOPRINT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; COUNT(*) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;INTO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;: TOTALOBS &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; HISTORY_DATA_TAB1; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;norecord&lt;/I&gt;&lt;/STRONG&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*%if &amp;amp;TOTALOBS eq 0 %then %do; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data norecord1;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;x= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;" NO RECORD FOUND FOR THIS CONTRACT "&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;TITLE &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Basic Information Report"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;PROC REPORT DATA= norecord1 MISSING;&lt;/P&gt;&lt;P&gt;COLUMN x&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;DEFINE X / DISPLAY &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"NO RECORD FOUND"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; FORMAT=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$CHAR40.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STYLE(column)={cellwidth=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2.2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;in}; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;/*%end; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;ALLRECORD1&lt;/I&gt;&lt;/STRONG&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;TITLE &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Basic Information Report"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC REPORT DATA=HISTORY_DATA_TAB1 MISSING;&lt;/P&gt;&lt;P&gt;COLUMNS&lt;/P&gt;&lt;P&gt;COMPANY_CODE&lt;/P&gt;&lt;P&gt;CONTRACT_NUMBER&lt;/P&gt;&lt;P&gt;ISSUE_DATE&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;DEFINE COMPANY_CODE / DISPLAY &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"COMPANY CODE"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; FORMAT=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$CHAR3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;DEFINE CONTRACT_NUMBER / DISPLAY &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"CONTRACT NUMBER"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; FORMAT=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$CHAR10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;DEFINE ISSUE_DATE / DISPLAY &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"ISSUE DATE"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; FORMAT=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$CHAR8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;ALL1&lt;/I&gt;&lt;/STRONG&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%IF&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;TOTALOBS NE &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%THEN&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;ALLRECORD1&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%ELSE&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;norecord&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%END&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;ALL1&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the point to note is that when HISTORY_DATA_TAB1&amp;nbsp; dataset has record , it run successfully and give output to excel without any error, while HISTORY_DATA_TAB1&amp;nbsp; dataset does not have any record&amp;nbsp; it is throwing error while opening excel file saying that excel is corrupted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This logic is working fine in all other reports i have created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can i get some help on this ?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 10:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341528#M5295</guid>
      <dc:creator>v9dduhan</dc:creator>
      <dc:date>2017-03-16T10:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving error as Excel file is corrupted after executing the stored procedure through web port</title>
      <link>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341542#M5296</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;You have two &lt;FONT face="courier new,courier"&gt;Content-disposition&lt;/FONT&gt; headers and it is unclear which one the browser honors. &amp;nbsp;You need only&amp;nbsp;one.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which ODS destination are you using?&lt;/P&gt;
&lt;P&gt;Are you using STPBEGIN and STPEND?&lt;/P&gt;
&lt;P&gt;What is the exact error that you get from Excel? &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there any errors, warnings, or messages in the SAS log?&lt;/P&gt;
&lt;P&gt;Can you save and then post a copy of the file that gives the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a common error that you encounter when the file extension does not match&amp;nbsp;the file content:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Error opening file: "The file format differs from the format that the file name extension specifies"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.microsoft.com/en-us/help/948615/error-opening-file-the-file-format-differs-from-the-format-that-the-file-name-extension-specifies" target="_self"&gt;https://support.microsoft.com/en-us/help/948615/error-opening-file-the-file-format-differs-from-the-format-that-the-file-name-extension-specifies&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 12:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Receiving-error-as-Excel-file-is-corrupted-after-executing-the/m-p/341542#M5296</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2017-03-16T12:07:16Z</dc:date>
    </item>
  </channel>
</rss>

