<?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: Filtering a Proc SQL by an expression in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-a-Proc-SQL-by-an-expression/m-p/43749#M11463</link>
    <description>[pre]&lt;BR /&gt;
data class;&lt;BR /&gt;
 set sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
data match;&lt;BR /&gt;
 sex='F';&lt;BR /&gt;
run;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 delete from class&lt;BR /&gt;
  where sex in (select sex from match);&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Before doing this code,Recommend you to back up your origin dataset,&lt;BR /&gt;
Because it will delete rows in the origin dataset.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Wed, 06 Apr 2011 06:15:52 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-04-06T06:15:52Z</dc:date>
    <item>
      <title>Filtering a Proc SQL by an expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-a-Proc-SQL-by-an-expression/m-p/43747#M11461</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to run a proc sql, deleting records where one variable = another variable but getting unexpected results. Basically I return many records where variable1 does indeed equal variable 2.&lt;BR /&gt;
&lt;BR /&gt;
Here's my code;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
	create table combined3 as&lt;BR /&gt;
	select	t1.PolicyNumber,&lt;BR /&gt;
			t1.AnnualPremium,&lt;BR /&gt;
			t2.AnnualPremium as AnnualPremium2&lt;BR /&gt;
	from 	brendan.aug as t1&lt;BR /&gt;
			left join&lt;BR /&gt;
			brendan.july as t2&lt;BR /&gt;
	on		t1.PolicyNumber = t2.PolicyNumber&lt;BR /&gt;
	where	t1.AnnualPremium = t2.AnnualPremium;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
If anyone can tell me what I'm doing wrong I'd be most appreciative.&lt;BR /&gt;
&lt;BR /&gt;
Many thanks in advamnce.</description>
      <pubDate>Tue, 05 Apr 2011 05:24:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-a-Proc-SQL-by-an-expression/m-p/43747#M11461</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-04-05T05:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering a Proc SQL by an expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-a-Proc-SQL-by-an-expression/m-p/43748#M11462</link>
      <description>presuming you mean to create a table (combined3) that only has records where the annual premium for a policy is different between brendan.aug and brendan.july, then:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table combined3 as&lt;BR /&gt;
select	t1.PolicyNumber,&lt;BR /&gt;
t1.AnnualPremium,&lt;BR /&gt;
t2.AnnualPremium as AnnualPremium2&lt;BR /&gt;
from brendan.aug as t1&lt;BR /&gt;
left join&lt;BR /&gt;
brendan.july as t2&lt;BR /&gt;
on	 t1.PolicyNumber = t2.PolicyNumber&lt;BR /&gt;
where	&lt;BR /&gt;
   t1.AnnualPremium ne coalesce(t2.AnnualPremium,0);&lt;BR /&gt;
quit;</description>
      <pubDate>Tue, 05 Apr 2011 11:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-a-Proc-SQL-by-an-expression/m-p/43748#M11462</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2011-04-05T11:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering a Proc SQL by an expression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Filtering-a-Proc-SQL-by-an-expression/m-p/43749#M11463</link>
      <description>[pre]&lt;BR /&gt;
data class;&lt;BR /&gt;
 set sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
data match;&lt;BR /&gt;
 sex='F';&lt;BR /&gt;
run;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 delete from class&lt;BR /&gt;
  where sex in (select sex from match);&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Before doing this code,Recommend you to back up your origin dataset,&lt;BR /&gt;
Because it will delete rows in the origin dataset.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 06 Apr 2011 06:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Filtering-a-Proc-SQL-by-an-expression/m-p/43749#M11463</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-06T06:15:52Z</dc:date>
    </item>
  </channel>
</rss>

