<?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: Excel and Stored process in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3674#M1793</link>
    <description>Ah, that's good. I generally do not change the result type with an override -- I define it when I set the metadata for the stored process. You can read about changing _RESULT here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/result.html" target="_blank"&gt;http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/result.html&lt;/A&gt;&lt;BR /&gt;
  &lt;BR /&gt;
And this is a list of all the reserved macro variables, where you can read about _ODSOPTIONS:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/reserved.html" target="_blank"&gt;http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/reserved.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
for most stored processes, I would not bother with overriding the value for the body= or file= file name -- but it makes some sense to name it for package results -- otherwise I think you get a default name of "main.htm"&lt;BR /&gt;
 &lt;BR /&gt;
FYI...when you open a destination like ODS CSVALL, you have to issue a close for the same destination:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods &lt;B&gt;CSVALL&lt;/B&gt; body=_webout;&lt;BR /&gt;
proc print data =work.test_results_for_XML label noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
ODS &lt;B&gt;CSVALL&lt;/B&gt; CLOSE; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
I'm assuming that you had a typo in your posting when you indicated that you used ODS CSV CLOSE.&lt;BR /&gt;
 &lt;BR /&gt;
When I use the Stored Process Web Application to launch a Stored Process to return CSV results from a URL, I do NOT need to use overrides for _RESULT or _ODSOPTIONS -- my streaming results come back correctly; however, Excel does get launched. If you do NOT want Excel to launch, then I can see where making a Package might suit your needs better.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Tue, 03 Jul 2007 15:47:52 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-07-03T15:47:52Z</dc:date>
    <item>
      <title>Excel and Stored process</title>
      <link>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3671#M1790</link>
      <description>Our stored process is a Unix server, I need to produce a CSV or Excel file from my stored process so that it can by used by other tools using the code below produces a file that Excel can read but not out other software. Is there a way to produce a "pure" csv or Excel file ??&lt;BR /&gt;
&lt;BR /&gt;
Data _null_;   &lt;BR /&gt;
rc = stpsrv_header('Content-type','application/vnd.ms-excel;'); &lt;BR /&gt;
rc = stpsrv_header("Content-disposition","attachment; filename=PPR_Temp.xls");&lt;BR /&gt;
run;    &lt;BR /&gt;
%let _odsdest=tagsets.msoffice2k;</description>
      <pubDate>Mon, 02 Jul 2007 12:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3671#M1790</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-07-02T12:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Excel and Stored process</title>
      <link>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3672#M1791</link>
      <description>Hi:&lt;BR /&gt;
The answer REALLY depends on what client application your end-users are going to use to surface the stored process results. &lt;BR /&gt;
   &lt;BR /&gt;
For example...if they will be using the SAS Add-in for Microsoft Office, then THEY can select CSV results from the SAS --&amp;gt; Options menu inside Excel. You don't have to do anything to your stored process if you allow them to make this choice. Ditto, if you write a "general" stored process and they select HTML as the result type -- then your stored process will come back as HTML -- using style information, such as font and colors --  if you allow them to make this choice.&lt;BR /&gt;
  &lt;BR /&gt;
You said that "using the code below produces a file that Excel can read but not our other software" -- what is the other software that you are using? You can return many different types of files with Stored Processes. This code should allow you to return a CSV file, assuming that the receiving software knows how to deal with a content-type header:&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data _null_; &lt;BR /&gt;
rc = stpsrv_header('Content-type','application/vnd.ms-excel;'); &lt;BR /&gt;
rc = stpsrv_header("Content-disposition","attachment; filename=PPR_Temp.xls");&lt;BR /&gt;
run; &lt;BR /&gt;
  &lt;BR /&gt;
%let _odsdest=tagsets.csv; &lt;BR /&gt;
*ProcessBody;&lt;BR /&gt;
%stpbegin;&lt;BR /&gt;
proc print data=sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
%stpend;&lt;BR /&gt;
&lt;BR /&gt;
** OR an alternate method to code the stored process would be:   ;&lt;BR /&gt;
&lt;BR /&gt;
Data _null_; &lt;BR /&gt;
rc = stpsrv_header('Content-type','application/vnd.ms-excel;'); &lt;BR /&gt;
rc = stpsrv_header("Content-disposition","attachment; filename=PPR_Temp.xls");&lt;BR /&gt;
run; &lt;BR /&gt;
  &lt;BR /&gt;
ods csv file=_webout;&lt;BR /&gt;
  proc print data=sashelp.class;&lt;BR /&gt;
  run;&lt;BR /&gt;
ods csv close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
Other destination values that you can use are:&lt;BR /&gt;
%let _odsdest = tagsets.excelxp;  /* Microsoft Spreadsheet ML XML results */&lt;BR /&gt;
%let _odsdest = tagsets.msoffice2k; /* Microsoft HTML results */&lt;BR /&gt;
%let _odsdest = tagsets.HTML3; /* W3C HTML 3.2 compliant tags */&lt;BR /&gt;
But the chances are good that ONLY Excel will open the ExcelXP and MSOFFICE2K files AND, your software mayor may not deal with the HTTP content-type header correctly. If you used the tagsets.HTML3 destination AND your other software knows how to open W3C-compliant HTML files, this may be your best bet. There is a list of content-type headers associated with CSV files (http://filext.com/file-extension/CSV) If your application does not like &lt;B&gt;vnd.ms-excel&lt;/B&gt; as shown above,perhaps it wants to have one of these MIME type headers:&lt;BR /&gt;
[pre]&lt;BR /&gt;
text/comma-separated-values &lt;BR /&gt;
text/csv &lt;BR /&gt;
application/csv &lt;BR /&gt;
application/excel &lt;BR /&gt;
application/vnd.ms-excel &lt;BR /&gt;
application/vnd.msexcel &lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
You could also use PROC EXPORT, but as you can read from several previous threads, this generally will write the XLS file on the server machine -- NOT on the end-user's local machine. &lt;BR /&gt;
 &lt;BR /&gt;
Your best bet for a definitive response, given your particular configuration and the other software you need to use to open the stored process results file, might be to contact Tech Support: &lt;A href="http://support.sas.com/techsup/contact/index.html" target="_blank"&gt;http://support.sas.com/techsup/contact/index.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 02 Jul 2007 15:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3672#M1791</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-07-02T15:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Excel and Stored process</title>
      <link>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3673#M1792</link>
      <description>Thanks &lt;BR /&gt;
Working with a collegue we found the following code worked but not quite sure why...&lt;BR /&gt;
data _null_;&lt;BR /&gt;
     rc = stpsrv_header('Content-type','application/vnd.ms-excel');&lt;BR /&gt;
     rc =&lt;BR /&gt;
     stpsrv_header('Content-disposition','attachment; filename=temp.csv');&lt;BR /&gt;
     run;&lt;BR /&gt;
      &lt;BR /&gt;
 %let _RESULT=PACKAGE;&lt;BR /&gt;
%let _ODSOPTIONS = %str(body="~/body.HTML") ;&lt;BR /&gt;
 %let _odsdest=tagsets.msoffice2k;    &lt;BR /&gt;
  %stpbegin ;&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
/**other code ; **/&lt;BR /&gt;
   %stpend;&lt;BR /&gt;
    ods CSVALL  body=_webout;&lt;BR /&gt;
proc print data =work.test_results_for_XML  label noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
  ODS CSV  CLOSE;</description>
      <pubDate>Tue, 03 Jul 2007 15:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3673#M1792</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-07-03T15:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Excel and Stored process</title>
      <link>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3674#M1793</link>
      <description>Ah, that's good. I generally do not change the result type with an override -- I define it when I set the metadata for the stored process. You can read about changing _RESULT here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/result.html" target="_blank"&gt;http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/result.html&lt;/A&gt;&lt;BR /&gt;
  &lt;BR /&gt;
And this is a list of all the reserved macro variables, where you can read about _ODSOPTIONS:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/reserved.html" target="_blank"&gt;http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/reserved.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
for most stored processes, I would not bother with overriding the value for the body= or file= file name -- but it makes some sense to name it for package results -- otherwise I think you get a default name of "main.htm"&lt;BR /&gt;
 &lt;BR /&gt;
FYI...when you open a destination like ODS CSVALL, you have to issue a close for the same destination:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods &lt;B&gt;CSVALL&lt;/B&gt; body=_webout;&lt;BR /&gt;
proc print data =work.test_results_for_XML label noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
ODS &lt;B&gt;CSVALL&lt;/B&gt; CLOSE; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
I'm assuming that you had a typo in your posting when you indicated that you used ODS CSV CLOSE.&lt;BR /&gt;
 &lt;BR /&gt;
When I use the Stored Process Web Application to launch a Stored Process to return CSV results from a URL, I do NOT need to use overrides for _RESULT or _ODSOPTIONS -- my streaming results come back correctly; however, Excel does get launched. If you do NOT want Excel to launch, then I can see where making a Package might suit your needs better.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 03 Jul 2007 15:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Excel-and-Stored-process/m-p/3674#M1793</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-07-03T15:47:52Z</dc:date>
    </item>
  </channel>
</rss>

