<?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: sql delete in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450941#M113607</link>
    <description>Since this is a SAS forum you can't expect us to u understand the syntax from other environments.&lt;BR /&gt;Basically, you probably need to replace the - with a WHERE EXISTS conditions.&lt;BR /&gt;For other differences, you should be able to detect by studying documentation and try running your code.</description>
    <pubDate>Wed, 04 Apr 2018 04:48:43 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2018-04-04T04:48:43Z</dc:date>
    <item>
      <title>sql delete</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450934#M113602</link>
      <description>&lt;P&gt;how do you convert the following sql into SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;delete from #table1&lt;BR /&gt;--select A.*&lt;BR /&gt;from #table1 a, #table2 b&lt;BR /&gt;where a.nbid = b.nbid&lt;BR /&gt;and a.campcode = b.Campcode&lt;BR /&gt;and a.trandate = b.trandate&lt;BR /&gt;and b.nbid_static is null&lt;BR /&gt;and A.Customer = 'TgtCust'&lt;BR /&gt;and A.Period = 'TgtPeriod'&lt;BR /&gt;and A.campctrl is null&lt;BR /&gt;go&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 03:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450934#M113602</guid>
      <dc:creator>galenhew</dc:creator>
      <dc:date>2018-04-04T03:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: sql delete</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450939#M113605</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
merge table1 (keep=_ALL_
              where=(cautomer='TgtCost' and Period='TgtPeriod'
                     and campctrl is missing))
      table2 (keep=nbid Campcode trandate nbid_static
              where=(nbid_static is missing));
  by nbid campcode trandate;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2018 04:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450939#M113605</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-04-04T04:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: sql delete</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450941#M113607</link>
      <description>Since this is a SAS forum you can't expect us to u understand the syntax from other environments.&lt;BR /&gt;Basically, you probably need to replace the - with a WHERE EXISTS conditions.&lt;BR /&gt;For other differences, you should be able to detect by studying documentation and try running your code.</description>
      <pubDate>Wed, 04 Apr 2018 04:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450941#M113607</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-04-04T04:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: sql delete</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450942#M113608</link>
      <description>&lt;P&gt;Just a guess, since I don't know that SQL dialect, Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;delete from table1 as A
where 
    Customer = 'TgtCust' and 
    Period = 'TgtPeriod' and 
    campctrl is null and
    exists (select * from table2 where 
        nbid_static is null and 
        nbid=A.nbid and 
        campcode=A.campcode and 
        trandate=A.trandate);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2018 04:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450942#M113608</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-04-04T04:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: sql delete</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450946#M113609</link>
      <description>&lt;P&gt;The simplest would be something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
merge table1 (in=A)
      table2 (in=B
              keep=nbid Campcode trandate nbid_static
              where=(nbid_static is missing));
  by nbid campcode trandate;
  if A;
  if B and Customer='TgtCust' and Period='TgtPeriod' and missing(campctrl) then delete;
  drop nbid_static;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;provided the join is not many to many.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 05:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-delete/m-p/450946#M113609</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-04-04T05:30:31Z</dc:date>
    </item>
  </channel>
</rss>

