<?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: Insert into with a where clause in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-into-with-a-where-clause/m-p/426137#M27447</link>
    <description>&lt;P&gt;What are you trying to insert? Here is an example of using the insert statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table test as
    select * from sashelp.class
      where age eq 12
  ;
  
   insert into test
     select * from sashelp.class
      where age ge 15
 ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2018 15:49:07 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-01-09T15:49:07Z</dc:date>
    <item>
      <title>Insert into with a where clause</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-into-with-a-where-clause/m-p/426133#M27446</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm tying to do an insert with a where clause to filter the operators that I've already have on the destination table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;INSERT INTO&amp;nbsp;LIBNAME.EMPLOYEES&amp;nbsp;AS T1&lt;BR /&gt;(OPERATOR,&lt;BR /&gt;CODE,&lt;BR /&gt;NAME,&lt;BR /&gt;POSITION,&lt;BR /&gt;DEPARTMENT,&lt;BR /&gt;STATUS)&lt;BR /&gt;SELECT *&lt;BR /&gt;FROM WORK.QUERY AS T2&lt;BR /&gt;WHERE T1.OPERATOR NE T2.OPERATOR;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 79-322: Expecting a SELECT.&lt;/P&gt;&lt;P&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 15:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-into-with-a-where-clause/m-p/426133#M27446</guid>
      <dc:creator>rodrichiez</dc:creator>
      <dc:date>2018-01-09T15:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into with a where clause</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-into-with-a-where-clause/m-p/426137#M27447</link>
      <description>&lt;P&gt;What are you trying to insert? Here is an example of using the insert statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table test as
    select * from sashelp.class
      where age eq 12
  ;
  
   insert into test
     select * from sashelp.class
      where age ge 15
 ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 15:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-into-with-a-where-clause/m-p/426137#M27447</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-09T15:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Insert into with a where clause</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-into-with-a-where-clause/m-p/426142#M27448</link>
      <description>&lt;P&gt;you can do this in two steps an example is shown&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* dataset 1*/
data have1;
input name $ age;
datalines;
bill 20
sam 10

;
/* dataset 2*/
data have2;
input name $ age;
datalines;
bill 20


;
/* create a temp table*/
proc sql;
create table have3 as
select * from have1
where trim(name) not in(select trim(name) from have2);
/* then insert into final table*/
proc sql;
insert into have2(name, age)
select * from have3;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 15:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Insert-into-with-a-where-clause/m-p/426142#M27448</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-01-09T15:58:08Z</dc:date>
    </item>
  </channel>
</rss>

