<?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: If  and if then do - What is the difference? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697589#M25426</link>
    <description>&lt;P&gt;The&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=p1cxl8ifdt8u0gn12wqbji8o5fq1.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;IF Statement: Subsetting&lt;/A&gt;&amp;nbsp;causes the data step (if the condition does not resolve to true) to immediately return to the top, skipping any remaining statements and starting the next iteration. This also means that the implicit OUTPUT at the end of the data step (if no explicit OUTPUT was coded) is not performed.&lt;/P&gt;
&lt;P&gt;The "normal" &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n1j60arf27ll4nn1ejavv3nby4pa.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;IF&lt;/A&gt; does not do this, and therefore all observations in your example are kept.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Nov 2020 12:38:42 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-11-09T12:38:42Z</dc:date>
    <item>
      <title>If  and if then do - What is the difference?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697476#M25411</link>
      <description>&lt;P&gt;Would you mind letting me know the difference of those two codes? I really don't know functionally what the difference is / what makes the difference of the 2 observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;&lt;P&gt;data cleandata36;&lt;BR /&gt;set cert.input36;&lt;BR /&gt;if upcase(Group) in ('A', 'B')&lt;FONT color="#FF0000"&gt; then do;&lt;/FONT&gt;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc contents data=cleandata36;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;data cleandata36;&lt;BR /&gt;set cert.input36;&lt;BR /&gt;if upcase(Group) in ('A', 'B');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc contents data=cleandata36;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Then do" is one difference. So, the only one difference of two codes is 'observation'&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Observations&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Observations&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;4992&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2020 23:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697476#M25411</guid>
      <dc:creator>dooheekim01</dc:creator>
      <dc:date>2020-11-08T23:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: If  and if then do - What is the difference?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697480#M25412</link>
      <description>The second IF is known as a SUBSETTING IF, where it filters the records to limited records that meet the condition. &lt;BR /&gt;&lt;BR /&gt;The first IF, will execute conditional logic between the DO/END statement but you have nothing so the first IF doesn't do anything. If you added a DELETE in between the DO;/END; it will then be the same. &lt;BR /&gt;&lt;BR /&gt;if upcase(Group) in ('A', 'B') then do;&lt;BR /&gt;DELETE;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;In general, you use IF/THEN/DO when you want to do more than one thing in the step. If you want to filter or only do one thing then you can stick with IF/THEN. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 08 Nov 2020 23:57:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697480#M25412</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-08T23:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: If  and if then do - What is the difference?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697585#M25425</link>
      <description>if upcase(Group) in ('A', 'B');&lt;BR /&gt;stands for&lt;BR /&gt;if upcase(Group) in ('A', 'B') then output;</description>
      <pubDate>Mon, 09 Nov 2020 11:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697585#M25425</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-11-09T11:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: If  and if then do - What is the difference?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697589#M25426</link>
      <description>&lt;P&gt;The&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=p1cxl8ifdt8u0gn12wqbji8o5fq1.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;IF Statement: Subsetting&lt;/A&gt;&amp;nbsp;causes the data step (if the condition does not resolve to true) to immediately return to the top, skipping any remaining statements and starting the next iteration. This also means that the implicit OUTPUT at the end of the data step (if no explicit OUTPUT was coded) is not performed.&lt;/P&gt;
&lt;P&gt;The "normal" &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n1j60arf27ll4nn1ejavv3nby4pa.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;IF&lt;/A&gt; does not do this, and therefore all observations in your example are kept.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 12:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/If-and-if-then-do-What-is-the-difference/m-p/697589#M25426</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-09T12:38:42Z</dc:date>
    </item>
  </channel>
</rss>

