<?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 Best practice on reading SAS datasets for outside system consumption in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43761#M374</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Let's say with DIS a data mart was created where the SAS dataset was in a SAS Engine. How would something like PHP(an example) access these? So instead rather then push this data mart into some DBMS, how to make the outside system access this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;jp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Nov 2011 19:41:19 GMT</pubDate>
    <dc:creator>jplarios</dc:creator>
    <dc:date>2011-11-08T19:41:19Z</dc:date>
    <item>
      <title>Best practice on reading SAS datasets for outside system consumption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43761#M374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Let's say with DIS a data mart was created where the SAS dataset was in a SAS Engine. How would something like PHP(an example) access these? So instead rather then push this data mart into some DBMS, how to make the outside system access this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;jp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 19:41:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43761#M374</guid>
      <dc:creator>jplarios</dc:creator>
      <dc:date>2011-11-08T19:41:19Z</dc:date>
    </item>
    <item>
      <title>Best practice on reading SAS datasets for outside system consumption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43762#M375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; For Windows, there's the SAS Drivers for ODBC and the SAS Providers for OLE DB.&amp;nbsp; I believe that both of those options (certainly ODBC) will require a running instance of SAS to act as a server.&amp;nbsp; I'd think that's an option if you were considering accessing a database server.&amp;nbsp; I'm sure there are lots more options.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 20:11:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43762#M375</guid>
      <dc:creator>MikeMcKiernan</dc:creator>
      <dc:date>2011-11-08T20:11:59Z</dc:date>
    </item>
    <item>
      <title>Best practice on reading SAS datasets for outside system consumption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43763#M376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And there is of course JDBC...&lt;/P&gt;&lt;P&gt;For these options you need a SAS server running, and if nothing has evolved in this area I think you need a SAS/SHARE server, and a license for SHARE*NET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another approach is to use programming against (width?) the Intergated Object Model, which is available though Integration Technologies product. See on-line doc for more info about that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Linus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 21:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43763#M376</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2011-11-08T21:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Best practice on reading SAS datasets for outside system consumption</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43764#M377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stored Processes can be used and if using a browser based interface it generally works well.&amp;nbsp; Just don't try and return a million row dataset etc. all at once.&amp;nbsp; You will need JBOSS or some other server running however.&amp;nbsp; Using this method is really easy with something like jQuery for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;$.ajax({&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; url:'your stored process url',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; data:'param1=foo&amp;amp;param2=bar',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; success: function(results){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $('#results').append(results);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; },&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; error: function(xhr){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $('#results').append('I'm sorry, I can't do that Dave.');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stored processes can be set up as Web Services as well and then consumed by your web application (data is returned as xml).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PHP in windows allows the use of Active X Data Objects via COM.&amp;nbsp; I did a quick test with the below snippet and it works.&amp;nbsp; You need to ensure you have loaded COM modules for PHP (I don't think they load by default).&amp;nbsp; The basic structure is the same as using something like ASP. When I tested this, I found I need to execute a libname statement prior to the SQL.&amp;nbsp; To see the return xml from the workspace server use the debugging options at the top of the script sample;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;//Debugging turned on in the PHP script as opposed to in PHP.ini.&amp;nbsp; Remove when complete.&lt;/P&gt;&lt;P&gt;ini_set('display_errors', 1); &lt;/P&gt;&lt;P&gt;ini_set('log_errors', 1); &lt;/P&gt;&lt;P&gt;ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); &lt;/P&gt;&lt;P&gt;error_reporting(E_ALL);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Set up the ADO Connection&lt;/P&gt;&lt;P&gt;$conn = new COM("ADODB.Connection") or die("Cannot start ADO.&amp;nbsp; Check your server has the SAS Drivers installed."); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// SAS Remote IOM Server Connection.&lt;/P&gt;&lt;P&gt;$conn-&amp;gt;Open("Provider=SAS.IOMProvider.9.2;Data Source=iom-bridge://&amp;lt;&amp;lt;SERVERNAME&amp;gt;&amp;gt;:8591;User ID=&amp;lt;&amp;lt;USERNAME&amp;gt;&amp;gt;;Password=&amp;lt;&amp;lt;PASSWORD&amp;gt;&amp;gt;");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Execute the SAS Code here.&amp;nbsp; For SQL, no need to use PROC SQL.&amp;nbsp; Libnames need to be defined first.&amp;nbsp; Can't see why datastep, procs etc couldn't be executed also.&lt;/P&gt;&lt;P&gt;$rs = $conn-&amp;gt;Execute("libname &amp;lt;&amp;lt;LIB&amp;gt;&amp;gt; '&amp;lt;&amp;lt;FILEPATH&amp;gt;&amp;gt;'");&lt;/P&gt;&lt;P&gt;$rs = $conn-&amp;gt;Execute("SELECT &amp;lt;&amp;lt;VARS&amp;gt;&amp;gt; FROM &amp;lt;&amp;lt;LIB&amp;gt;&amp;gt;.&amp;lt;&amp;lt;DATASET&amp;gt;&amp;gt;");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Display all the values in the records set&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;echo "&amp;lt;p&amp;gt;The Below Data is from SAS.&amp;lt;/p&amp;gt;";&lt;/P&gt;&lt;P&gt; while (!$rs-&amp;gt;EOF) { &lt;/P&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $fv = $rs-&amp;gt;Fields("&amp;lt;&amp;lt;VARS&amp;gt;&amp;gt;");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Value: ".$fv-&amp;gt;value."&amp;lt;br&amp;gt;\n";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $rs-&amp;gt;MoveNext();&lt;/P&gt;
&lt;P&gt;} &lt;/P&gt;
&lt;P&gt;$rs-&amp;gt;Close();&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Cameron Lawson&#xD;
Added additional step in sample code after testing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2012 00:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Best-practice-on-reading-SAS-datasets-for-outside-system/m-p/43764#M377</guid>
      <dc:creator>CameronL</dc:creator>
      <dc:date>2012-01-03T00:33:11Z</dc:date>
    </item>
  </channel>
</rss>

