<?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: Proc SQL - Import a table function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322108#M271069</link>
    <description>&lt;P&gt;Hi thanks for your answer,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I should have the cut off date&amp;nbsp;as result.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2017 11:58:40 GMT</pubDate>
    <dc:creator>cmachado</dc:creator>
    <dc:date>2017-01-03T11:58:40Z</dc:date>
    <item>
      <title>Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322102#M271067</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to import a table function from my data base with Proc Sql but I'm having troubles with the parameters of this function.&lt;/P&gt;&lt;P&gt;In sql I import like this - select * from xxx (GETDATE()) in SAS i'm doing like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc sql;&lt;BR /&gt;Create table SBK as&lt;BR /&gt;Select *&lt;BR /&gt;From xxx (today());&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the function is not recognized, anyone know how to do it?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 11:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322102#M271067</guid>
      <dc:creator>cmachado</dc:creator>
      <dc:date>2017-01-03T11:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322105#M271068</link>
      <description>&lt;P&gt;What should happen with the today() portion of the query?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 11:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322105#M271068</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-03T11:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322108#M271069</link>
      <description>&lt;P&gt;Hi thanks for your answer,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I should have the cut off date&amp;nbsp;as result.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 11:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322108#M271069</guid>
      <dc:creator>cmachado</dc:creator>
      <dc:date>2017-01-03T11:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322116#M271070</link>
      <description>&lt;P&gt;Either&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Select * From xxx (Where=(Date=Today()));

* .. OR ..;

Select * From xxx Where Date=Today();

* ??;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Jan 2017 12:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322116#M271070</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2017-01-03T12:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322117#M271071</link>
      <description>Thanks for the help.&lt;BR /&gt;I try to use both examples you send me and I have this error in log.&lt;BR /&gt;Parameters were not supplied for the function</description>
      <pubDate>Tue, 03 Jan 2017 12:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322117#M271071</guid>
      <dc:creator>cmachado</dc:creator>
      <dc:date>2017-01-03T12:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322121#M271072</link>
      <description>&lt;P&gt;You query does not look like SQL to me. &amp;nbsp;If you want the select the result of the TODAY() function then you should reference the function in the list of values in the SELECT statement not treat it as if it was a table and try to reference it in the FROM clause. &amp;nbsp;However PROC SQL does expect to see a FROM clause in a query. &amp;nbsp;You could try referencing a table like SASHELP.CLASS that should always exist.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table SBK as
    select today() format=date9. as today
    from sashelp.class(obs=1)
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 13:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322121#M271072</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-01-03T13:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322136#M271073</link>
      <description>Hi Tom,&lt;BR /&gt;&lt;BR /&gt;The example you send me works but don't work to what I pretend.&lt;BR /&gt;Probably I don't explain well, I want to access to a sql function (not a table) using SAS.&lt;BR /&gt;It's that possible?&lt;BR /&gt;Thanks in advanced&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Jan 2017 14:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322136#M271073</guid>
      <dc:creator>cmachado</dc:creator>
      <dc:date>2017-01-03T14:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322145#M271074</link>
      <description>&lt;P&gt;Yes, you can use functions but they have to be SAS functions and valid SAS code. The code you've posted isn't valid so without knowing anything besides a desire to use a function, all we can say is, yes you can use functions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it a DB function or a user defined function or a SAS function?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the documentation and examples. If you need further help post more details.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/69822/HTML/default/viewer.htm#p0jhh7e1ipagann1bygfcb3mqvcg.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/69822/HTML/default/viewer.htm#p0jhh7e1ipagann1bygfcb3mqvcg.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 14:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322145#M271074</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-03T14:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322158#M271075</link>
      <description>&lt;P&gt;If you want to run SQL code in your foreign database (Oracle, MySQL, Teradata, SQL Server, etc) then you have two methods in PROC SQL. &amp;nbsp;You can query using the FROM CONNECTION TO XXX syntax of a SELECT statement or you can just run code by using the EXECUTE statement. &amp;nbsp;The code you send must be valid syntax for the foreign database. &amp;nbsp;To retreive the data from running a procedure in the database it return results that look to SAS like the result of a query. &amp;nbsp;You might need to wrap the function call inside of SELECT statement in the foreign database code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
  connect to xxx ..... ;
  create table work.mydata as 
    select * from connection to xxx
    ( select * from mytable_function() )
  ;
  execute (myfunction()) by xxx ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322158#M271075</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-01-03T15:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322182#M271076</link>
      <description>&lt;P&gt;Post the LOG with the code and the error message. Paste into the {i} code box.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322182#M271076</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-03T15:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322202#M271077</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;I ran the query you sent me and I got results but with an error (proc sql;&lt;BR /&gt;25 connect to ODBC as teste&lt;BR /&gt;26 (noprompt = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;BR /&gt;27 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;BR /&gt;28 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&lt;BR /&gt;29 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX);&lt;BR /&gt;30&lt;BR /&gt;31 create table work.mydata as&lt;BR /&gt;32 select * from connection to teste&lt;BR /&gt;33 ( select * from dbo.CutOffLegalPhases ('2017-01-01') );&lt;BR /&gt;NOTE: Compressing data set WORK.MYDATA decreased size by 84.70 percent.&lt;BR /&gt;Compressed is 1432 pages; un-compressed would require 9362 pages.&lt;BR /&gt;NOTE: Table WORK.MYDATA created, with 383834 rows and 32 columns.&lt;/P&gt;&lt;P&gt;34 execute ( dbo.CutOffLegalPhases('2017-01-01') ) by teste;&lt;BR /&gt;ERROR: CLI execute error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '2017-01-01'.&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;35 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 36.92 seconds&lt;BR /&gt;cpu time 4.44 seconds&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 17:01:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322202#M271077</guid>
      <dc:creator>cmachado</dc:creator>
      <dc:date>2017-01-03T17:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322210#M271078</link>
      <description>&lt;P&gt;Looks like it worked!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Table WORK.MYDATA created, with 383834 rows and 32 columns.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You don't need to use the EXECUTE () statement. &amp;nbsp;That is for commands you want to run that do NOT return results.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 17:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322210#M271078</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-01-03T17:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL - Import a table function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322213#M271079</link>
      <description>&lt;P&gt;It works Tom, thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 17:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Import-a-table-function/m-p/322213#M271079</guid>
      <dc:creator>cmachado</dc:creator>
      <dc:date>2017-01-03T17:42:30Z</dc:date>
    </item>
  </channel>
</rss>

