<?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: Sintax error using insert from a Teradata table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Sintax-error-using-insert-from-a-Teradata-table/m-p/624449#M20100</link>
    <description>&lt;P&gt;In proc sql, you have to use SAS SQL syntax. "over" is not a valid syntax element in SAS SQL.&lt;/P&gt;
&lt;P&gt;You will have to build a sub-select.&lt;/P&gt;
&lt;P&gt;If you post usable example data (data step with datalines) and what you expect out of it, we can make up code for this.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2020 11:41:14 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-02-13T11:41:14Z</dc:date>
    <item>
      <title>Sintax error using insert from a Teradata table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Sintax-error-using-insert-from-a-Teradata-table/m-p/624442#M20099</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could some on please help me with this bit of code? I do not have an idea how to fix it .&lt;/P&gt;&lt;P&gt;Many thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc SQL;
INSERT INTO jorquec.sp_handset_base2    

SELECT a.*,                
       MIN(device_type_id) OVER (PARTITION BY subscr_id ORDER BY effective_from_dt ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING)  AS prev_device,
           CASE WHEN device_type_id = prev_device THEN 0 ELSE 1 END AS flag
                
FROM PROFTMDL.sp_handset_base a
WHERE device_type_id &amp;lt;&amp;gt; -1 ;

QUIT;

______________________________________

LOG FILE :

23         GOPTIONS ACCESSIBLE;
24         


25         proc SQL;
26         INSERT INTO jorquec.sp_handset_base2
27         
28         SELECT a.*,
29                MIN(device_type_id) OVER (PARTITION BY subscr_id ORDER BY effective_from_dt ROWS BETWEEN 1 PRECEDING AND 1
                                      ____
                                      22
                                      76
29       ! PRECEDING)  AS prev_device,
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN, 
              CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.  

ERROR 76-322: Syntax error, statement will be ignored.

30                    CASE WHEN device_type_id = prev_device THEN 0 ELSE 1 END AS flag
31         
32         FROM PROFTMDL.sp_handset_base a
33         WHERE device_type_id &amp;lt;&amp;gt; -1 ;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
34         
35         QUIT;
NOTE: The SAS System stopped processing this step because of errors.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2020 10:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Sintax-error-using-insert-from-a-Teradata-table/m-p/624442#M20099</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2020-02-13T10:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sintax error using insert from a Teradata table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Sintax-error-using-insert-from-a-Teradata-table/m-p/624449#M20100</link>
      <description>&lt;P&gt;In proc sql, you have to use SAS SQL syntax. "over" is not a valid syntax element in SAS SQL.&lt;/P&gt;
&lt;P&gt;You will have to build a sub-select.&lt;/P&gt;
&lt;P&gt;If you post usable example data (data step with datalines) and what you expect out of it, we can make up code for this.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 11:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Sintax-error-using-insert-from-a-Teradata-table/m-p/624449#M20100</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-13T11:41:14Z</dc:date>
    </item>
  </channel>
</rss>

