<?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: Calculating time between a series of dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492742#M129539</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42157"&gt;@sarahsasuser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have prescription data and am trying to look at patterns&amp;nbsp;of use. I'd like to create an array that calculates the time between dates to see how often people fill their prescriptions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have up to 300 dates for each person and want to create time variables that is the number of months between prescription refills. What is the best way to do this so that I can easily see the number of months between Rx for each person (and be able to average them)? I also want to count the number of prescriptions each person has.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have wide data and though of this array:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;array date(*) date1-date300;&lt;/P&gt;
&lt;P&gt;array time(*) time1 - time299;&lt;/P&gt;
&lt;P&gt;do i=1 to 315;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if date(i) ^=. then do;&lt;/P&gt;
&lt;P&gt;time(i)=ink('month', date(i),date(i+1)); *want the number of months between each date;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well, other than you spelled INTCK as INK, and your array index goes 1 to 315, instead of&amp;nbsp;1 to 299, I think you have the proper code.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Sep 2018 17:52:44 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-09-05T17:52:44Z</dc:date>
    <item>
      <title>Calculating time between a series of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492740#M129538</link>
      <description>&lt;P&gt;I have prescription data and am trying to look at patterns&amp;nbsp;of use. I'd like to create an array that calculates the time between dates to see how often people fill their prescriptions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have up to 300 dates for each person and want to create time variables that is the number of months between prescription refills. What is the best way to do this so that I can easily see the number of months between Rx for each person (and be able to average them)? I also want to count the number of prescriptions each person has.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have wide data and though of this array:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;array date(*) date1-date300;&lt;/P&gt;
&lt;P&gt;array time(*) time1 - time299;&lt;/P&gt;
&lt;P&gt;do i=1 to 315;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if date(i) ^=. then do;&lt;/P&gt;
&lt;P&gt;time(i)=ink('month', date(i),date(i+1)); *want the number of months between each date;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 17:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492740#M129538</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2018-09-05T17:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time between a series of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492742#M129539</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42157"&gt;@sarahsasuser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have prescription data and am trying to look at patterns&amp;nbsp;of use. I'd like to create an array that calculates the time between dates to see how often people fill their prescriptions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have up to 300 dates for each person and want to create time variables that is the number of months between prescription refills. What is the best way to do this so that I can easily see the number of months between Rx for each person (and be able to average them)? I also want to count the number of prescriptions each person has.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have wide data and though of this array:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;array date(*) date1-date300;&lt;/P&gt;
&lt;P&gt;array time(*) time1 - time299;&lt;/P&gt;
&lt;P&gt;do i=1 to 315;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if date(i) ^=. then do;&lt;/P&gt;
&lt;P&gt;time(i)=ink('month', date(i),date(i+1)); *want the number of months between each date;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well, other than you spelled INTCK as INK, and your array index goes 1 to 315, instead of&amp;nbsp;1 to 299, I think you have the proper code.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 17:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492742#M129539</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-05T17:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time between a series of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492743#M129540</link>
      <description>&lt;P&gt;Transpose your dataset, use lag() to determine the difference between observations, and then proc means/summary for the calculation.&lt;/P&gt;
&lt;P&gt;See Maxim 49.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 17:56:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492743#M129540</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-05T17:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time between a series of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492744#M129541</link>
      <description>&lt;P&gt;Thanks for catching that. I fixed the code and I get an error that says the array subscript is out of range. I'm missing something...&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 17:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492744#M129541</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2018-09-05T17:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time between a series of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492745#M129542</link>
      <description>&lt;P&gt;i must not exceed 299.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 18:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492745#M129542</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-05T18:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time between a series of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492746#M129543</link>
      <description>&lt;P&gt;ah thanks! that's what I was missing!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 18:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-time-between-a-series-of-dates/m-p/492746#M129543</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2018-09-05T18:07:42Z</dc:date>
    </item>
  </channel>
</rss>

