<?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: help with if in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197680#M49404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is comparison that returns true/false or 1/0. So if day(bday)&amp;gt;day(current) is true it becomes 1 and the equation becomes:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;age=age-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;otherwise it becomes:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;age=age-0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;You can test it via&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;Y=day(bday)&amp;gt;day(current);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;There's some details and comparisons on these formula's here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/39473" title="https://communities.sas.com/thread/39473"&gt;https://communities.sas.com/thread/39473&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;I think intck with age option also calculates age correctly as of SAS 9.3+&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Jul 2015 22:04:16 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-07-07T22:04:16Z</dc:date>
    <item>
      <title>help with if</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197677#M49401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;CODE style="padding: 10px 0 8px; font-size: inherit !important;"&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;PRE style="padding-bottom: 8px; font-family: monospace; color: #333333; font-size: inherit !important;"&gt;&lt;CODE style="padding: 10px 0 8px; font-size: inherit !important;"&gt; data birth; input name $ bday :mmddyy10.; datalines; Miguel 12/31/1973 Joe 02/28/1976 Rutger 03/29/1976 Broguen 03/01/1976 Susan 12/12/1976 Michael 02/14/1971 LeCe 11/09/1967 Hans 07/02/1955 Lou 07/30/1960 ; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE style="padding: 10px 0 8px; font-size: inherit !important;"&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="padding: 10px 0 8px; font-size: inherit !important;"&gt;data ages;&lt;BR /&gt;&amp;nbsp; set birth;&lt;BR /&gt;&amp;nbsp; retain current;&lt;BR /&gt;&amp;nbsp; if _n_=1 then current=today();&lt;BR /&gt;&amp;nbsp; format bday current worddate20.;&lt;BR /&gt;&amp;nbsp; age=int(intck('month',bday,current)/12);&lt;BR /&gt;&amp;nbsp; if month(bday)=month(current) then age=age-(day(bday)&amp;gt;day(current));&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;How is the if condition solved here?Can someone explain it?Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197677#M49401</guid>
      <dc:creator>NoorulIyn</dc:creator>
      <dc:date>2015-07-07T21:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: help with if</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197678#M49402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which if condition?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first states uses the automatic variable _n_, which essentially states if this is the first record in the dataset set the variable current to today.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197678#M49402</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-07T21:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: help with if</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197679#M49403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for not being clear,the second if.&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;(&lt;STRONG&gt;day(bday)&amp;gt;day(current)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 21:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197679#M49403</guid>
      <dc:creator>NoorulIyn</dc:creator>
      <dc:date>2015-07-07T21:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: help with if</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197680#M49404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is comparison that returns true/false or 1/0. So if day(bday)&amp;gt;day(current) is true it becomes 1 and the equation becomes:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;age=age-1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;otherwise it becomes:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;age=age-0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;You can test it via&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;Y=day(bday)&amp;gt;day(current);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;There's some details and comparisons on these formula's here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/39473" title="https://communities.sas.com/thread/39473"&gt;https://communities.sas.com/thread/39473&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;I think intck with age option also calculates age correctly as of SAS 9.3+&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 22:04:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197680#M49404</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-07T22:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: help with if</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197681#M49405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background: white;"&gt;SAS evaluates the expression in an IF-THEN statement to produce a result that is either True or False (1 or 0). A result of zero causes the expression to be false, while a nonzero result causes the expression to be true. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background: white;"&gt;Back to your question,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background: white;"&gt;The MONTH function returns a numeric value that represents the month from a SAS date value. Numeric values can range from 1 (Jan.) through 12 (Dec.).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; background: white;"&gt; If month(bday)=month(current)&lt;/SPAN&gt; means if the month of variable ‘bday’ is equal to current month.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 05:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-if/m-p/197681#M49405</guid>
      <dc:creator>HarryLiu</dc:creator>
      <dc:date>2015-07-08T05:03:07Z</dc:date>
    </item>
  </channel>
</rss>

