<?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: How to pick records for ID's which dont have certain codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-records-for-ID-s-which-dont-have-certain-codes/m-p/568869#M160228</link>
    <description>&lt;P&gt;I also could not think of a better way than you suggested. Ended up, typing your thought in a code form. Here it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;

	CREATE TABLE FirstTable AS 
	SELECT * 
	FROM test 
		WHERE rev_cd IN('802');

	SELECT Test.ID 
	FROM Test 
	LEFT JOIN FirstTable ON Test.ID=FirstTable.ID 
	WHERE Test.ID ^=FirstTable.ID;

QUIT;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Jun 2019 17:10:50 GMT</pubDate>
    <dc:creator>koyelghosh</dc:creator>
    <dc:date>2019-06-25T17:10:50Z</dc:date>
    <item>
      <title>How to pick records for ID's which dont have certain codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-records-for-ID-s-which-dont-have-certain-codes/m-p/568856#M160224</link>
      <description>&lt;P&gt;Thanks for reading. So, I have a dataset as below-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;input id $ claim_id $ rev_cd $;&lt;BR /&gt;datalines;&lt;BR /&gt;a a1 801&lt;BR /&gt;a a1 802&lt;BR /&gt;a a2 801&lt;BR /&gt;a a3 821&lt;BR /&gt;b b1 901&lt;BR /&gt;b b1 802&lt;BR /&gt;c c2 821&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to pick those Id's which do not have certain revenue code - for ex, 802- in any of its claims. Using Proc SQL as below it still picks a and b whereas I only want c.&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select distinct id from test where rev_cd not in ( '802');&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;One way I can think of is having a table of records with id's having rev_cd as 802 and another table with id's not having rev_cd as 802. That way I can do a left join to extract C. But Im sure there is better way to solve this problem, but cant seem to think of it.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 16:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-records-for-ID-s-which-dont-have-certain-codes/m-p/568856#M160224</guid>
      <dc:creator>devsas</dc:creator>
      <dc:date>2019-06-25T16:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick records for ID's which dont have certain codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-records-for-ID-s-which-dont-have-certain-codes/m-p/568861#M160226</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/40777"&gt;@devsas&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid subqueries or additional joins you can use GROUP BY and HAVING with a suitable summary function (e.g. MAX or SUM) operating on Boolean values:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select id
from test
group by id
having max(rev_cd='802')=0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 16:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-records-for-ID-s-which-dont-have-certain-codes/m-p/568861#M160226</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-06-25T16:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick records for ID's which dont have certain codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-records-for-ID-s-which-dont-have-certain-codes/m-p/568869#M160228</link>
      <description>&lt;P&gt;I also could not think of a better way than you suggested. Ended up, typing your thought in a code form. Here it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;

	CREATE TABLE FirstTable AS 
	SELECT * 
	FROM test 
		WHERE rev_cd IN('802');

	SELECT Test.ID 
	FROM Test 
	LEFT JOIN FirstTable ON Test.ID=FirstTable.ID 
	WHERE Test.ID ^=FirstTable.ID;

QUIT;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2019 17:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-records-for-ID-s-which-dont-have-certain-codes/m-p/568869#M160228</guid>
      <dc:creator>koyelghosh</dc:creator>
      <dc:date>2019-06-25T17:10:50Z</dc:date>
    </item>
  </channel>
</rss>

