<?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: Decoding sas code in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187843#M47641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might have to study up on a couple of things ... how does SAS store dates, what do the functions INTCK and INTNX actually do ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since Tom already commented on the second code sample, here's the idea of the first one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTCK computes number of months that have passed.&amp;nbsp; (Technically, it calculates how many "1st of the month" dates fall between the two dates.)&amp;nbsp; The Min/Max computations are more often found in SQL code for bounding a variable.&amp;nbsp; This code is basically saying to calculate how many months have passed, then add 1, then limit the calculation to falling between 1 and 5.&amp;nbsp; If the calculation comes up with more than 5, use 5.&amp;nbsp; If it comes up with less than 1, use 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jul 2014 14:48:41 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2014-07-21T14:48:41Z</dc:date>
    <item>
      <title>Decoding sas code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187841#M47639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been asked to help convert some code from sas to another software application&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code sample 1&lt;/P&gt;&lt;P&gt;months_in_trial = &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;max(1,min(5,1+&lt;/STRONG&gt;&lt;/SPAN&gt;intck('month',trial_start_dt,&amp;amp;pbd_date)));&lt;/P&gt;&lt;P&gt;I understand a portion of the code intck('month',trial_start_dt,&amp;amp;pbd_date))); means to take trial_start_dt and compare it to the &amp;amp;pbd_date.&amp;nbsp; I am attempting to decode the portion marked in red.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code sample 2:&lt;/P&gt;&lt;P&gt;trial_start_dt = intnx( 'month' ,d_lm_trial_on_street_dt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;,1+(day(d_lm_trial_on_street_dt)&amp;gt;15) );&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears the code is saying to compare the trial_start_dt with the first day of the tria_on_the_street_dt then add 15 days. I am looking for confirmation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 14:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187841#M47639</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2014-07-21T14:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Decoding sas code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187842#M47640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Result of boolean expressions in SAS will be 0 or 1.&lt;/P&gt;&lt;P&gt;Do (day(xxx)&amp;gt;15) will return 1 if the day of the month is greater than 15 and 0 otherwise.&lt;/P&gt;&lt;P&gt;So it the INTNX function will generate the next month when the day of the month is the 15th or earlier and the month after that when the day of the month is after the 15th.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 14:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187842#M47640</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-21T14:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Decoding sas code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187843#M47641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might have to study up on a couple of things ... how does SAS store dates, what do the functions INTCK and INTNX actually do ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since Tom already commented on the second code sample, here's the idea of the first one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTCK computes number of months that have passed.&amp;nbsp; (Technically, it calculates how many "1st of the month" dates fall between the two dates.)&amp;nbsp; The Min/Max computations are more often found in SQL code for bounding a variable.&amp;nbsp; This code is basically saying to calculate how many months have passed, then add 1, then limit the calculation to falling between 1 and 5.&amp;nbsp; If the calculation comes up with more than 5, use 5.&amp;nbsp; If it comes up with less than 1, use 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 14:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187843#M47641</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-07-21T14:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Decoding sas code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187844#M47642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 14:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decoding-sas-code/m-p/187844#M47642</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2014-07-21T14:55:08Z</dc:date>
    </item>
  </channel>
</rss>

