<?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: Can I hijack _webout? in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Can-I-hijack-webout/m-p/85410#M3574</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks much Vince, that does the trick, and is a better approach than any of the 3 options I proposed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guess I need to spend more time reading through the definition of %stpbegin to see how it is parameterized. Effectively, there already is a body= parameter that defaults to _webout.&amp;nbsp; But since %stpbegin doesnt have any parameters defined :smileyalert:, it's taken from &amp;amp;_ODSOPTIONS.&amp;nbsp; After reading your solution, it of course becomes clear as day.&amp;nbsp; (Below snippets from %stpbegin() with my comments added):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*Figure out if user has specified an output file in &amp;amp;_ODSOPTIONS;&lt;/P&gt;&lt;P&gt;%let TEMPSTR=%qupcase(%qcmpres(%bquote(&amp;amp;_ODSOPTIONS)));&lt;/P&gt;&lt;P&gt;%if (%index(&amp;amp;TEMPSTR, BODY=) GT 0) or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (%index(&amp;amp;TEMPSTR, BODY &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt; GT 0) or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (%index(&amp;amp;TEMPSTR, FILE=) GT 0) or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (%index(&amp;amp;TEMPSTR, FILE &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt; GT 0) %then&lt;BR /&gt;&amp;nbsp; %let BODYFLAG=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*If user is streaming output and has not specified an output file, send stream to _webout;&lt;/P&gt;&lt;P&gt;%else %if (%qupcase(%qcmpres(&amp;amp;_RESULT)) eq STREAM) and&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;amp;BODYFLAG eq 0) %then %do;&lt;BR /&gt;&amp;nbsp; %let ODSOPT=&amp;amp;ODSOPT body=_WEBOUT;&lt;BR /&gt;%end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2012 13:30:33 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2012-08-07T13:30:33Z</dc:date>
    <item>
      <title>Can I hijack _webout?</title>
      <link>https://communities.sas.com/t5/Developers/Can-I-hijack-webout/m-p/85408#M3572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could be a crazy idea, but I'm was wondering if I could hijack _webout to send results to a file instead of the browser, when using %stpbegin/%stpend.&amp;nbsp; So far, seems like the answer is no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Asked another way, suppose I want to write results to a file on the server (pdf/html/rtf), rather than stream them to a browser, when a user runs a stored process (through SPWA).&amp;nbsp; I see 3 possibilities:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Wanting to use %stpbegin/%stpend in the stored process, was thinking I would try just redirecting the _webout fileref to point to a file.&amp;nbsp; But clearly _webout is more than your typical fileref.&amp;nbsp; So filename _webout "~/somewhere/myfile.htm" fails.&amp;nbsp; Is there a way to hijack _webout?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Assuming I can't redirect _webout, another option would be to redefine %stpbegin(), adding a parameter for body= which would default to _webout, but allow the developer to specify an altenative.&amp;nbsp; So %stpbegin(body="~/somewhere/myfile.htm") or something like that.&amp;nbsp; But then there is part of me that hates the idea of putting a revised definition of %stpbegin() in my personal/project autocall library to replace the SI provided macro.&amp;nbsp; Because anyone who sees %stpbegin() will assume it's calling the usual %stpbegin, and of course SAS will likely keep expanding the functionality of %stpbegin() over time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; Which makes me think I'll just write my own, limited, alternative to %stbegin().&amp;nbsp; A simple macro that would generate an ODS &amp;amp;_odsdest statement, sending results to a user-specified file, with user-specified options. Benefit of this approach is that I have control (and understanding) of what it does.&amp;nbsp; But down side is I would potentially miss out on some of the magical possibilities of %stpbegin().&lt;/P&gt;&lt;P&gt;Currently I've been playing with #3, but was wondering if #1 is possible, or if people would share my concerns about #2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2012 19:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Can-I-hijack-webout/m-p/85408#M3572</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-08-06T19:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can I hijack _webout?</title>
      <link>https://communities.sas.com/t5/Developers/Can-I-hijack-webout/m-p/85409#M3573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%let _ODSOPTIONS=%str(path='~/somewhere' body='myfile.htm');&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;options mprint;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%STPBEGIN;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; proc print data=sashelp.class; run; quit;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%STPEND;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 12:25:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Can-I-hijack-webout/m-p/85409#M3573</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2012-08-07T12:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can I hijack _webout?</title>
      <link>https://communities.sas.com/t5/Developers/Can-I-hijack-webout/m-p/85410#M3574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks much Vince, that does the trick, and is a better approach than any of the 3 options I proposed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guess I need to spend more time reading through the definition of %stpbegin to see how it is parameterized. Effectively, there already is a body= parameter that defaults to _webout.&amp;nbsp; But since %stpbegin doesnt have any parameters defined :smileyalert:, it's taken from &amp;amp;_ODSOPTIONS.&amp;nbsp; After reading your solution, it of course becomes clear as day.&amp;nbsp; (Below snippets from %stpbegin() with my comments added):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*Figure out if user has specified an output file in &amp;amp;_ODSOPTIONS;&lt;/P&gt;&lt;P&gt;%let TEMPSTR=%qupcase(%qcmpres(%bquote(&amp;amp;_ODSOPTIONS)));&lt;/P&gt;&lt;P&gt;%if (%index(&amp;amp;TEMPSTR, BODY=) GT 0) or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (%index(&amp;amp;TEMPSTR, BODY &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt; GT 0) or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (%index(&amp;amp;TEMPSTR, FILE=) GT 0) or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (%index(&amp;amp;TEMPSTR, FILE &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt; GT 0) %then&lt;BR /&gt;&amp;nbsp; %let BODYFLAG=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*If user is streaming output and has not specified an output file, send stream to _webout;&lt;/P&gt;&lt;P&gt;%else %if (%qupcase(%qcmpres(&amp;amp;_RESULT)) eq STREAM) and&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;amp;BODYFLAG eq 0) %then %do;&lt;BR /&gt;&amp;nbsp; %let ODSOPT=&amp;amp;ODSOPT body=_WEBOUT;&lt;BR /&gt;%end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 13:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Can-I-hijack-webout/m-p/85410#M3574</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-08-07T13:30:33Z</dc:date>
    </item>
  </channel>
</rss>

