<?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: Set two dataset with if condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Set-two-dataset-with-if-condition/m-p/464660#M118486</link>
    <description>&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;P&gt;For me, uppercase is easier to read. Anyway, thank you for your suggestion!!&lt;/P&gt;</description>
    <pubDate>Thu, 24 May 2018 08:24:27 GMT</pubDate>
    <dc:creator>TristanTang</dc:creator>
    <dc:date>2018-05-24T08:24:27Z</dc:date>
    <item>
      <title>Set two dataset with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Set-two-dataset-with-if-condition/m-p/464649#M118481</link>
      <description>&lt;P&gt;An example program is followed. i am wondering why the last observation in dataset C&amp;nbsp;had a value of 'B' in the column&amp;nbsp;OUTCOME?&lt;/P&gt;&lt;P&gt;Thank you all!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA A;&lt;/P&gt;&lt;P&gt;INPUT OBS $ OUTCOME $;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 A&lt;BR /&gt;2 B&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA B;&lt;BR /&gt;INPUT OBS $ RESULT $;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 1&lt;BR /&gt;2 2&lt;BR /&gt;3 .&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;BR /&gt;DATA C;&lt;BR /&gt;SET A(IN = A) B(IN = B);&lt;BR /&gt;IF A THEN DATASET = 'A';&lt;BR /&gt;IF B THEN DO;&lt;BR /&gt;DATASET = 'B';&lt;BR /&gt;IF RESULT = '1' THEN OUTCOME = 'A';&lt;BR /&gt;ELSE IF RESULT = '2' THEN OUTCOME = 'B';&lt;BR /&gt;END;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 07:28:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Set-two-dataset-with-if-condition/m-p/464649#M118481</guid>
      <dc:creator>TristanTang</dc:creator>
      <dc:date>2018-05-24T07:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set two dataset with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Set-two-dataset-with-if-condition/m-p/464655#M118483</link>
      <description>&lt;P&gt;First, keep in mind that all variables in datasets named in a set (or merge) statement are automatically retained.&lt;/P&gt;
&lt;P&gt;So, when the second dataset B is being read, outcome will always be retained from the previous iteration of the data step.&lt;/P&gt;
&lt;P&gt;Since the next-to-last observation in B has a result of '2', outcome is set to 'B'; In the last observation, result is missing, so none of the conditons in the do/end block is met, and outcome stays at value 'B'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW stop coding in uppercase-only. Interpreters and compilers understand lowercase since the 60's, and it makes code easier to read.&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 08:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Set-two-dataset-with-if-condition/m-p/464655#M118483</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-24T08:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set two dataset with if condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Set-two-dataset-with-if-condition/m-p/464660#M118486</link>
      <description>&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;P&gt;For me, uppercase is easier to read. Anyway, thank you for your suggestion!!&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 08:24:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Set-two-dataset-with-if-condition/m-p/464660#M118486</guid>
      <dc:creator>TristanTang</dc:creator>
      <dc:date>2018-05-24T08:24:27Z</dc:date>
    </item>
  </channel>
</rss>

