<?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: Sub setting the data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306820#M65654</link>
    <description>&lt;P&gt;When I run your code as posted I get exactly the desired result posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your unexpected result is coming from a larger different data set A or the logic is more complex then that could be the diffrence. If you expect an output record everytime variable A=1 it may be that variable B has unexpected values such as missing or out of range of the exact values placed in the IN operator arguement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Oct 2016 14:36:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-10-24T14:36:17Z</dc:date>
    <item>
      <title>Sub setting the data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306627#M65597</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying below code to subset the but not getting result as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA A;&lt;BR /&gt;INFILE DATALINES DSD DLM=' ';&lt;BR /&gt;INPUT A B;&lt;BR /&gt;DATALINES;&lt;BR /&gt;1 1&lt;BR /&gt;1 2&lt;BR /&gt;1 3&lt;BR /&gt;1 4&lt;BR /&gt;1 5&lt;BR /&gt;1 6&lt;BR /&gt;1 7&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;BR /&gt;DATA X Y;&lt;BR /&gt;SET A;&lt;BR /&gt;IF A=1 AND B IN (1,2,3) THEN OUTPUT X;&lt;BR /&gt;IF A=1 AND B IN (4,5,6,7) THEN OUTPUT Y;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;expected result:&lt;/P&gt;
&lt;P&gt;Data set X:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 3&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Data set Y:&lt;BR /&gt;&lt;SPAN&gt;1 4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1 7&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;can anyone please let me know where I am doing wrong.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2016 13:30:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306627#M65597</guid>
      <dc:creator>PravinMishra</dc:creator>
      <dc:date>2016-10-23T13:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sub setting the data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306628#M65598</link>
      <description>&lt;P&gt;Take a look at dataset a, if it really looks as expected.&lt;/P&gt;
&lt;P&gt;Next, inspect the log of both steps; if that does not give you a clue, post the log and the list outputs of both datasets.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2016 14:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306628#M65598</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-23T14:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sub setting the data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306632#M65599</link>
      <description>&lt;P&gt;Your expectations are right on the money.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many times, the board can diagnose the error with no help ... no log, no PROC PRINT results, no PROC CONTENTS results. &amp;nbsp;Unfortunately, this is not one of those times. &amp;nbsp;If you didn't get what you expected, you may have to show what the results actually were.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2016 17:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306632#M65599</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-23T17:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sub setting the data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306820#M65654</link>
      <description>&lt;P&gt;When I run your code as posted I get exactly the desired result posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your unexpected result is coming from a larger different data set A or the logic is more complex then that could be the diffrence. If you expect an output record everytime variable A=1 it may be that variable B has unexpected values such as missing or out of range of the exact values placed in the IN operator arguement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sub-setting-the-data-set/m-p/306820#M65654</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-24T14:36:17Z</dc:date>
    </item>
  </channel>
</rss>

