<?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: Help with filtering data in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697032#M25333</link>
    <description>&lt;P&gt;Yes I agree. Performance being the criteria, DO&lt;SPAN&gt;W&amp;nbsp; is indeed the best. It's just that I find some of the Proc SQL functionality very trendy and user-friendly&amp;nbsp;while being seated among a group of general business users. They just enjoy fastfood and done. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Even beginners seem to grasp so quickly. I guess that accomplishes much of our credit risk queries at ease.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Nov 2020 00:34:36 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-11-06T00:34:36Z</dc:date>
    <item>
      <title>Help with filtering data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/696974#M25324</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using this sample data:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Code&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a new table that pulls observations where an ID has both Code 'A' and Code 'C' associated with it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the final data would look like:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Code&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 20:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/696974#M25324</guid>
      <dc:creator>marleeakerson</dc:creator>
      <dc:date>2020-11-05T20:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/696987#M25326</link>
      <description>&lt;P&gt;Run a double DO loop, since it is sorted:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
do until (last.id);
  set have;
  by id;
  if code = 'A' then _a = 1;
  if code = 'C' then _c = 1;
end;
do until (last.id);
  set have;
  by id;
  if _a and _c then output;
end;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Nov 2020 21:19:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/696987#M25326</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-05T21:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697016#M25331</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281255"&gt;@marleeakerson&lt;/a&gt;&amp;nbsp; If you wanna try the PROC SQL aka "Readymeals" solution, it's worth having fun.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input ID         Code $;
 cards;
1              A

1              B

1              C

2              A

2              B
2			   A

3              A

3              B

3              C
;



proc sql;
 create table want as
 select *
 from have
 group by id
 having count(distinct ifc(code in ('A','C'),code,' '))=2
 order by id,code;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp; How on earth you folks could be so genius and creative to think of IFC/IFN making it too user friendly(aka readymeals) to a fault. Kudos!!!*1E6. Just an incredible thought to envision it in the first place. If the designer would accept an ordinary bloke's appreciation, please let him/her know the privileges we enjoy.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 22:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697016#M25331</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-05T22:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697028#M25332</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;: I think the condition&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;having max(code='A') &amp;amp; max(code='C')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(or with SUM instead of MAX) would improve performance. (At least it did on my computer with 5.5 million obs. in HAVE of which 48% were selected: It was more than three times faster, but still much slower [about factor 2] than the double DOW loop.)&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 23:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697028#M25332</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-05T23:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697032#M25333</link>
      <description>&lt;P&gt;Yes I agree. Performance being the criteria, DO&lt;SPAN&gt;W&amp;nbsp; is indeed the best. It's just that I find some of the Proc SQL functionality very trendy and user-friendly&amp;nbsp;while being seated among a group of general business users. They just enjoy fastfood and done. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Even beginners seem to grasp so quickly. I guess that accomplishes much of our credit risk queries at ease.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 00:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697032#M25333</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-06T00:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with filtering data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697126#M25342</link>
      <description>&lt;P&gt;Love to see the different creative solutions here.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IFC (and IFN) is a SAS function, not native to SQL.&amp;nbsp; Sometimes we need a SAS function to do the job -- there are so many available and SQL doesn't have analogous functions for all of them.&amp;nbsp; But you might pay a performance penalty for using a SAS function in PROC SQL&amp;nbsp;&lt;STRONG&gt;especially&lt;/STRONG&gt; when working with database data.&amp;nbsp; SAS tries to push as much work to the database as possible, but a unique SAS function will force SAS to bring at least some of the data over and increase the I/O cost.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 12:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-with-filtering-data/m-p/697126#M25342</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-11-06T12:33:13Z</dc:date>
    </item>
  </channel>
</rss>

