<?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: first and last records within a specific date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-records-within-a-specific-date/m-p/858662#M339260</link>
    <description>&lt;P&gt;You should show some worked examples.&lt;/P&gt;
&lt;P&gt;I am having a hard time following which values are compared for this: "i need to assign 1 if within a specific period (56 days) from start date there will be one or more service date less than 56 days , otherwise NRR = 0 if there are a service after 56 days."&lt;/P&gt;
&lt;P&gt;Are you intending to use only the service_date for &lt;STRONG&gt;each&lt;/STRONG&gt; observation or compare other dates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF your start_date and service_date are actual SAS date values you can get the number of days by either subtraction or the Intck function and the interval of days:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Days_between = service_date&amp;nbsp; - start_date;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;Days_between= intck('day',start_date,service_date);&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2023 05:47:09 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-02-14T05:47:09Z</dc:date>
    <item>
      <title>first and last records within a specific date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-records-within-a-specific-date/m-p/858650#M339252</link>
      <description>&lt;P&gt;Hello gays,&lt;/P&gt;&lt;P&gt;need help , as new sas programmer , i am in phase to finish my project so, i need to create a variable accally a binary variable&amp;nbsp; from my date, this is a type of date who i dealing with&amp;nbsp;&lt;/P&gt;&lt;P&gt;ANM_id&amp;nbsp; &amp;nbsp; &amp;nbsp;lact_no&amp;nbsp; &amp;nbsp;start_date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;service_date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NNR&lt;/P&gt;&lt;P&gt;111&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2013-01-06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2013-03-15&lt;/P&gt;&lt;P&gt;111&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2013-01-06&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 2013-04-04&lt;/P&gt;&lt;P&gt;111&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2014-01-10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 2014-04-21&lt;/P&gt;&lt;P&gt;111&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2014-01-10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2014-05-10&lt;/P&gt;&lt;P&gt;222&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2015-10-01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;2015-11-15&lt;/P&gt;&lt;P&gt;222&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2016-01-01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2016-02-06&lt;/P&gt;&lt;P&gt;222&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2016-01-01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 2016-02-26&lt;/P&gt;&lt;P&gt;i need to assign 1&amp;nbsp; if within a specific period (56 days)&amp;nbsp; from start date there will be one or more service date less than 56 days , otherwise NRR = 0&amp;nbsp; if there are a service after 56 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 02:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-records-within-a-specific-date/m-p/858650#M339252</guid>
      <dc:creator>Ameurgen</dc:creator>
      <dc:date>2023-02-14T02:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: first and last records within a specific date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-records-within-a-specific-date/m-p/858662#M339260</link>
      <description>&lt;P&gt;You should show some worked examples.&lt;/P&gt;
&lt;P&gt;I am having a hard time following which values are compared for this: "i need to assign 1 if within a specific period (56 days) from start date there will be one or more service date less than 56 days , otherwise NRR = 0 if there are a service after 56 days."&lt;/P&gt;
&lt;P&gt;Are you intending to use only the service_date for &lt;STRONG&gt;each&lt;/STRONG&gt; observation or compare other dates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF your start_date and service_date are actual SAS date values you can get the number of days by either subtraction or the Intck function and the interval of days:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Days_between = service_date&amp;nbsp; - start_date;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;Days_between= intck('day',start_date,service_date);&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 05:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-records-within-a-specific-date/m-p/858662#M339260</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-14T05:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: first and last records within a specific date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-records-within-a-specific-date/m-p/858687#M339275</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;nnr = (0 &amp;lt;= (service_date - start_date) &amp;lt;= 56);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;Assuming&lt;/EM&gt; that your date values are stored as SAS date values.&lt;/P&gt;
&lt;P&gt;For complete, tested code supply example data in a data step with datalines, so we can create an &lt;U&gt;exact&lt;/U&gt; replica of your dataset with a simple copy/paste and submit.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 10:42:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-records-within-a-specific-date/m-p/858687#M339275</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-14T10:42:24Z</dc:date>
    </item>
  </channel>
</rss>

