<?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: Programming: How to subset data in SAS as one would in R or Python. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641007#M191006</link>
    <description>&lt;P&gt;So is there any problem with just doing a simple not equal to?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where key ne 'case 3';&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 18 Apr 2020 22:20:02 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2020-04-18T22:20:02Z</dc:date>
    <item>
      <title>Programming: How to subset data in SAS as one would in R or Python.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641004#M191005</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have table of this structure with more than 1 flags, (have just 1 flag here for simplicity).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I create another table with no 'case 3' in it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to remove all cases where FLAG_1 is 0(for all occurrence of that case), but not those where it's either 0,1 or 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One option I can think of is by using MAX(FLAG_1) with group by 'Key' to create a table and then do right join. But I have several FLAG columns such as these and looking for some R, Python type of solution for concision.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Key&lt;/TD&gt;&lt;TD&gt;FLAG_1&lt;/TD&gt;&lt;TD&gt;Conclusion&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;include&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;include&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;include&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;include&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;remove&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;remove&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 3&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;remove&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;case 4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;include&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 07:23:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641004#M191005</guid>
      <dc:creator>captainprice0</dc:creator>
      <dc:date>2020-04-19T07:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Programming: How to subset data in SAS as one would in R or Python.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641007#M191006</link>
      <description>&lt;P&gt;So is there any problem with just doing a simple not equal to?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where key ne 'case 3';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Apr 2020 22:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641007#M191006</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-04-18T22:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Programming: How to subset data in SAS as one would in R or Python.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641049#M191025</link>
      <description>&lt;P&gt;haha!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;actually there are millions of 'Key' in my datasets, case 1,2, and 3 are just an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to logically identify them, based on the presence of FLAG column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As FLAG will either have '1' or '0' in them, but they are not uniform across all instance of cases.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 06:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641049#M191025</guid>
      <dc:creator>captainprice0</dc:creator>
      <dc:date>2020-04-19T06:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Programming: How to subset data in SAS as one would in R or Python.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641050#M191026</link>
      <description>&lt;P&gt;If I were to do this in R let's say,&lt;/P&gt;&lt;P&gt;I would write a max() function which will generate a table with distinct Key and there corresponding maximum value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do this in SQL would require me to write a groub by statement on Key with select MAX(FLAG_1)&lt;BR /&gt;but I will have to repeat this for all instances of FLAG I have and then join these tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way of doing this quickly in SAS?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 06:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Programming-How-to-subset-data-in-SAS-as-one-would-in-R-or/m-p/641050#M191026</guid>
      <dc:creator>captainprice0</dc:creator>
      <dc:date>2020-04-19T06:59:05Z</dc:date>
    </item>
  </channel>
</rss>

