<?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: what is the difference in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500141#M133152</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;- have to agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;. Try both, decide and post your reasons here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While you're at it, you can also try my favourite (simplest &amp;amp; unambiguous):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;flag=ifn(sex='F',1,0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 30 Sep 2018 04:44:08 GMT</pubDate>
    <dc:creator>AndrewHowell</dc:creator>
    <dc:date>2018-09-30T04:44:08Z</dc:date>
    <item>
      <title>what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500137#M133149</link>
      <description>&lt;P&gt;data test;&lt;BR /&gt;input id age sex $;&lt;BR /&gt;cards;&lt;BR /&gt;1 25 Male&lt;BR /&gt;2 35 Female&lt;BR /&gt;3 29 Female&lt;BR /&gt;4 37 Male&lt;BR /&gt;5 32 Male&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ex1:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ex1 ;&lt;/P&gt;&lt;P&gt;set test ;&lt;/P&gt;&lt;P&gt;if sex='F' then flag=1 ;&lt;/P&gt;&lt;P&gt;else flag=0 ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ex2 ;&lt;/P&gt;&lt;P&gt;set test ;&lt;/P&gt;&lt;P&gt;flag=sex='F' ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;what is the difference between ex1 and ex2&lt;/P&gt;&lt;P&gt;can you give some more examples&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2018 03:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500137#M133149</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2018-09-30T03:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500139#M133150</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Sounds like a study question which you should try to answer yourself.&lt;/P&gt;
&lt;P&gt;If you want support with this then may be post here your thoughts what the difference could be and ask for some feedback on your thoughts.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2018 03:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500139#M133150</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-09-30T03:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500141#M133152</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;- have to agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;. Try both, decide and post your reasons here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While you're at it, you can also try my favourite (simplest &amp;amp; unambiguous):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;flag=ifn(sex='F',1,0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 30 Sep 2018 04:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500141#M133152</guid>
      <dc:creator>AndrewHowell</dc:creator>
      <dc:date>2018-09-30T04:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500148#M133157</link>
      <description>&lt;P&gt;O I so want to reply to how the ifn works, since the same logic arguments are the same in Excel, but I should leave that to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;. &amp;nbsp;&lt;/P&gt;&lt;P&gt;But I can not help myself.&lt;/P&gt;&lt;P&gt;first what is the conduction being tested!&lt;/P&gt;&lt;P&gt;second what is the value set if the conduction is true!&lt;/P&gt;&lt;P&gt;else what his the value set if the conduction is false!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is why we create programs, test, set true else set false.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2018 05:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500148#M133157</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-09-30T05:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500232#M133185</link>
      <description>&lt;P&gt;Just a warning about&amp;nbsp;&lt;FONT face="courier new,courier"&gt;ifn()&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;All three function parameters (test, result true, result false) are always executed by SAS.&lt;/P&gt;
&lt;P&gt;So&lt;FONT face="courier new,courier"&gt; C = ifn(B&amp;gt;0, A/B, 0)&amp;nbsp;&lt;/FONT&gt; will not work as expected and can still generate a division by zero.&lt;/P&gt;
&lt;P&gt;Not to mention the wasted CPU cycles evaluating a value that will never be used (when the values are formulas).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2018 22:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500232#M133185</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-09-30T22:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500234#M133186</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;- good to know about ifn(), thanks. Wasn't aware the&amp;nbsp;parameters are executed regardless.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CPU cycles - concur, but also balancing simplicity/complexity of maintenance with same of execution. &lt;EM&gt;(But will keep an eye on future implementations.)&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2018 22:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500234#M133186</guid>
      <dc:creator>AndrewHowell</dc:creator>
      <dc:date>2018-09-30T22:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500240#M133188</link>
      <description>&lt;P&gt;I still like the IFx functions and use them a lot for the reason you mention, but they would be more useful if all 3 parameters were not always evaluated. This will probably never happen.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2018 23:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500240#M133188</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-09-30T23:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500449#M133285</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data test;&lt;BR /&gt;input id age sex $;&lt;BR /&gt;cards;&lt;BR /&gt;1 25 Male&lt;BR /&gt;2 35 Female&lt;BR /&gt;3 29 Female&lt;BR /&gt;4 37 Male&lt;BR /&gt;5 32 Male&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ex1:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data ex1 ;&lt;/P&gt;
&lt;P&gt;set test ;&lt;/P&gt;
&lt;P&gt;if sex='F' then flag=1 ;&lt;/P&gt;
&lt;P&gt;else flag=0 ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data ex2 ;&lt;/P&gt;
&lt;P&gt;set test ;&lt;/P&gt;
&lt;P&gt;flag=sex='F' ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;what is the difference between ex1 and ex2&lt;/P&gt;
&lt;P&gt;can you give some more examples&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Proc compare will provide a comparison of values row by row with diagnostics about matching / nonmatching values if that is what you my by "difference between ex1 and ex2".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since both sets are comparing for a value that does not exist (your sex variable is "Female" "Male" not "F" or "M") I wouldn't expect to see any matches at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be default when you do a comparison between values SAS will yield 1 for true and 0 for false. Does that give you a hint what is going on?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 15:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500449#M133285</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-01T15:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: what is the difference</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500470#M133290</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your datalines where like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id age sex $;
cards;
1 25 M
2 35 F
3 29 F
4 37 M
5 32 M
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;there would be no difference in you code.&lt;/P&gt;&lt;P&gt;or if you fixed the testing to evaluate only the first char for sex then there would be no difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 16:15:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-difference/m-p/500470#M133290</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-10-01T16:15:49Z</dc:date>
    </item>
  </channel>
</rss>

