<?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: Selecting rows that contains certains values stored in another table in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1528#M482</link>
    <description>If you want to output to two data sets in the same step, the a data step is the best way to go.&lt;BR /&gt;
&lt;BR /&gt;
Try the following code.  Keeping in mind that you may need to prefix your tables with the appropriate library references.&lt;BR /&gt;
&lt;BR /&gt;
data mytrans errors;&lt;BR /&gt;
  merge people (rename=(id=id_people)) (in=p)&lt;BR /&gt;
        transactions (in=t);&lt;BR /&gt;
  by id_people;&lt;BR /&gt;
  if p=1 and t=1 then&lt;BR /&gt;
    output mytrans;&lt;BR /&gt;
  else&lt;BR /&gt;
    output errors;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
If you can't find the data sets after running this have a look in your 'work' library.

&lt;BR /&gt;
Message was edited by: DW at Oct 11, 2006 7:40 PM&lt;BR /&gt;</description>
    <pubDate>Wed, 11 Oct 2006 23:39:58 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2006-10-11T23:39:58Z</dc:date>
    <item>
      <title>Selecting rows that contains certains values stored in another table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1525#M479</link>
      <description>Hi guys,&lt;BR /&gt;
&lt;BR /&gt;
How can I select rows in a data set based on values stored in another data set?&lt;BR /&gt;
&lt;BR /&gt;
Eg:&lt;BR /&gt;
DATA PEOPLE contains:&lt;BR /&gt;
row id name&lt;BR /&gt;
1 100 marcos&lt;BR /&gt;
2 101 maria&lt;BR /&gt;
&lt;BR /&gt;
DATA TRANSACTIONS contains:&lt;BR /&gt;
row id id_people value&lt;BR /&gt;
1 10 100 39$&lt;BR /&gt;
2 11 100 33$&lt;BR /&gt;
3 12 101 300$&lt;BR /&gt;
4 13 102 400$&lt;BR /&gt;
5 14 100 8$&lt;BR /&gt;
6 15 102 98$&lt;BR /&gt;
&lt;BR /&gt;
I want to select all rows in TRANSACTIONS that have id_people listed on PEOPLE (In this case, rows 1, 2, 3 and 5). How can I do that the best way possible in SAS?</description>
      <pubDate>Mon, 09 Oct 2006 20:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1525#M479</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-10-09T20:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting rows that contains certains values stored in another table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1526#M480</link>
      <description>The easies way if you are using Enterprise Guide is to do a 'filter and query' step that joins your two tables.  When you create the join you will probably need to do a manual join to link the two tables on your ID.&lt;BR /&gt;
&lt;BR /&gt;
Let me know if you need more information on how to do this.&lt;BR /&gt;
&lt;BR /&gt;
Cheers</description>
      <pubDate>Mon, 09 Oct 2006 22:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1526#M480</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-10-09T22:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting rows that contains certains values stored in another table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1527#M481</link>
      <description>Well, i want to store in a data called ERRORS all the other rows that not have id_people listed in PEOPLE. In this example, rows 4 and 6.&lt;BR /&gt;
Can I do that using the DATA STEP?</description>
      <pubDate>Wed, 11 Oct 2006 13:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1527#M481</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-10-11T13:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting rows that contains certains values stored in another table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1528#M482</link>
      <description>If you want to output to two data sets in the same step, the a data step is the best way to go.&lt;BR /&gt;
&lt;BR /&gt;
Try the following code.  Keeping in mind that you may need to prefix your tables with the appropriate library references.&lt;BR /&gt;
&lt;BR /&gt;
data mytrans errors;&lt;BR /&gt;
  merge people (rename=(id=id_people)) (in=p)&lt;BR /&gt;
        transactions (in=t);&lt;BR /&gt;
  by id_people;&lt;BR /&gt;
  if p=1 and t=1 then&lt;BR /&gt;
    output mytrans;&lt;BR /&gt;
  else&lt;BR /&gt;
    output errors;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
If you can't find the data sets after running this have a look in your 'work' library.

&lt;BR /&gt;
Message was edited by: DW at Oct 11, 2006 7:40 PM&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Oct 2006 23:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Selecting-rows-that-contains-certains-values-stored-in-another/m-p/1528#M482</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-10-11T23:39:58Z</dc:date>
    </item>
  </channel>
</rss>

