<?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: Making subsets of a table. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Making-subsets-of-a-table/m-p/9753#M586</link>
    <description>proc sql;&lt;BR /&gt;
 create table_c as &lt;BR /&gt;
    select * &lt;BR /&gt;
    from table_a &lt;BR /&gt;
    where id not in (select distinct id from table_b)&lt;BR /&gt;
 ;&lt;BR /&gt;
quit;</description>
    <pubDate>Fri, 30 Oct 2009 09:51:08 GMT</pubDate>
    <dc:creator>FredrikE</dc:creator>
    <dc:date>2009-10-30T09:51:08Z</dc:date>
    <item>
      <title>Making subsets of a table.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-subsets-of-a-table/m-p/9752#M585</link>
      <description>I have a table A, containing individuals with variables ID(=identity) and seven other variables, VAR1-VAR7.&lt;BR /&gt;
&lt;BR /&gt;
VAR1 can have the values 0, 1 or 2.&lt;BR /&gt;
&lt;BR /&gt;
From table A, I want to make two other tables, B and C.&lt;BR /&gt;
&lt;BR /&gt;
In B I want all records where VAR1=0. That is easy to get.&lt;BR /&gt;
&lt;BR /&gt;
In C I want all records for the individuals not found in B.&lt;BR /&gt;
&lt;BR /&gt;
Concerning number of records this means that B+C le A, because the individuals found in B could also have records in A, where VAR1=1 or VAR1=2.&lt;BR /&gt;
&lt;BR /&gt;
How do I get C?</description>
      <pubDate>Fri, 30 Oct 2009 08:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-subsets-of-a-table/m-p/9752#M585</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-30T08:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Making subsets of a table.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-subsets-of-a-table/m-p/9753#M586</link>
      <description>proc sql;&lt;BR /&gt;
 create table_c as &lt;BR /&gt;
    select * &lt;BR /&gt;
    from table_a &lt;BR /&gt;
    where id not in (select distinct id from table_b)&lt;BR /&gt;
 ;&lt;BR /&gt;
quit;</description>
      <pubDate>Fri, 30 Oct 2009 09:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-subsets-of-a-table/m-p/9753#M586</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2009-10-30T09:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Making subsets of a table.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-subsets-of-a-table/m-p/9754#M587</link>
      <description>data b c;&lt;BR /&gt;
  set a;&lt;BR /&gt;
  if var1=0 then output b;&lt;BR /&gt;
            else output c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Oops, not. too quick to answer.  C could have the other var1=1 and var1=2 records for people in B.&lt;BR /&gt;
&lt;BR /&gt;
So a second step is reqquired.&lt;BR /&gt;
could use proc sql with not in as above or "not exist".&lt;BR /&gt;
Could also use&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=b; by id;&lt;BR /&gt;
proc sort data=c; by id;&lt;BR /&gt;
&lt;BR /&gt;
data c;&lt;BR /&gt;
  merge b(in=inb) c(in=inc);&lt;BR /&gt;
  by id;&lt;BR /&gt;
  if inc and not inb then output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
but I think the sql is the better way to go.

Message was edited by: Chuck</description>
      <pubDate>Fri, 30 Oct 2009 17:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-subsets-of-a-table/m-p/9754#M587</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-30T17:49:32Z</dc:date>
    </item>
  </channel>
</rss>

