<?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: INTNX or INTCK in DO Loop with no end date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603735#M16981</link>
    <description>&lt;P&gt;Welcome to the world of dates, that's one of the reasons that SAS expertise are so great.&amp;nbsp; They know how to look at dates and ask what are they really asking for based on what they are giving me.&amp;nbsp; Dates the world of programming.&amp;nbsp;&lt;EM&gt; 'Payments due, past dues, death because of inability for system to identify date and time of entry.'&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2019 01:10:38 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2019-11-13T01:10:38Z</dc:date>
    <item>
      <title>INTNX or INTCK in DO Loop with no end date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603719#M16977</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my data set there are a variety of hospital reporting data, each item of data has an affiliated date. I am working to normalize the data as I am using it to track progress towards a goal, but each hospital started at different times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now my code is cumbersome, and I&amp;nbsp;&lt;STRONG&gt;know&lt;/STRONG&gt; it is not ideal, but can't quite figure out how to fix it. What I ultimately want is a numeric variable (Month_Enroll) that provides the number of months before or after the start date that a case is from. For example, if a hospital started in June 2018, I would want all cases from May 2018 to have a Month_Enroll of -1 and all cases from July 2017 to have a Month_Enroll of 1.&amp;nbsp; This data set is constantly be updated, so I am trying to write a program that will require minimum maintenance. I feel like I should be able to accomplish what I need with a DO Loop, but haven't been successful so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have (it isn't working how I want). Delivery date = date a baby was born, record_id is affiliated with a hospital&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA Set.Clean;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FORMAT delivery_date&amp;nbsp; YYMMN6.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FORMAT Hospital_Start YYMMN6.;&lt;BR /&gt;&lt;BR /&gt;SET Set.Old;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Hospital_Start = 06/01/2018;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF FIND(record_id, "56073") THEN DO;&lt;BR /&gt;Month_Enroll = delivery_date - Luth_Start;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 22:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603719#M16977</guid>
      <dc:creator>BlairWhitty</dc:creator>
      <dc:date>2019-11-12T22:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX or INTCK in DO Loop with no end date [how to improve your question]</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603724#M16978</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299394"&gt;@BlairWhitty&lt;/a&gt;,&lt;/P&gt;&lt;BR /&gt; &lt;P&gt;Your question requires more details before experts can help.&amp;nbsp;Can you revise your question to include more information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Review this checklist:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Specify a meaningful subject line for your topic.&amp;nbsp; Avoid generic subjects like "need help," "SAS query," or "urgent."&lt;/LI&gt;
&lt;LI&gt;When appropriate, provide sample data in text or DATA step format.&amp;nbsp; See &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;this article for one method&lt;/A&gt;&amp;nbsp;you can use.&lt;/LI&gt;
&lt;LI&gt;If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition.&amp;nbsp;Use the&amp;nbsp;&lt;STRONG&gt;Photos&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;button to include the image in your message.&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 279px;"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/16608i91A52F817EAC9A69/image-dimensions/279x150?v=1.0" width="279" height="150" alt="use_buttons.png" title="use_buttons.png" /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;It also helps to include an example (table or picture) of the result that you're trying to achieve.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To edit your original message, select the "blue gear" icon at the top of the message and select&amp;nbsp;&lt;STRONG&gt;Edit Message&lt;/STRONG&gt;.&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;From there you can adjust the title and add more details to the body of the message.&amp;nbsp; Or, simply reply to this message with any additional information you can supply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 229px;"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/16605iAC020BC79315B045/image-size/large?v=1.0&amp;amp;px=600" alt="edit_post.png" title="edit_post.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;SAS experts are eager to help -- help&amp;nbsp;&lt;EM&gt;them&lt;/EM&gt; by providing as much detail as you can.&lt;/P&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style:italic;font-size:smaller;"&gt;This prewritten response was triggered for you by fellow SAS Support Communities member &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;.</description>
      <pubDate>Tue, 12 Nov 2019 23:09:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603724#M16978</guid>
      <dc:creator>Community_Guide</dc:creator>
      <dc:date>2019-11-12T23:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX or INTCK in DO Loop with no end date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603725#M16979</link>
      <description>&lt;P&gt;I don't think this does what you think it does:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Hospital_Start = 06/01/2018;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;That will be come 6 divided by 1 divided by 2018 which is a number. When you specify sas dates you need to use date literals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would specify the above line as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Hospital_Start = "01Jun2018"d;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a great, but longer and in depth, reference for dates and times in SAS&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299394"&gt;@BlairWhitty&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my data set there are a variety of hospital reporting data, each item of data has an affiliated date. I am working to normalize the data as I am using it to track progress towards a goal, but each hospital started at different times.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right now my code is cumbersome, and I&amp;nbsp;&lt;STRONG&gt;know&lt;/STRONG&gt; it is not ideal, but can't quite figure out how to fix it. What I ultimately want is a numeric variable (Month_Enroll) that provides the number of months before or after the start date that a case is from. For example, if a hospital started in June 2018, I would want all cases from May 2018 to have a Month_Enroll of -1 and all cases from July 2017 to have a Month_Enroll of 1.&amp;nbsp; This data set is constantly be updated, so I am trying to write a program that will require minimum maintenance. I feel like I should be able to accomplish what I need with a DO Loop, but haven't been successful so far.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I have (it isn't working how I want). Delivery date = date a baby was born, record_id is affiliated with a hospital&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA Set.Clean;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FORMAT delivery_date&amp;nbsp; YYMMN6.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FORMAT Hospital_Start YYMMN6.;&lt;BR /&gt;&lt;BR /&gt;SET Set.Old;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Hospital_Start = 06/01/2018;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF FIND(record_id, "56073") THEN DO;&lt;BR /&gt;Month_Enroll = delivery_date - Luth_Start;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate any help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 23:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603725#M16979</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-12T23:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX or INTCK in DO Loop with no end date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603726#M16980</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299394"&gt;@BlairWhitty&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my data set there are a variety of hospital reporting data, each item of data has an affiliated date. I am working to normalize the data as I am using it to track progress towards a goal, but each hospital started at different times.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right now my code is cumbersome, and I&amp;nbsp;&lt;STRONG&gt;know&lt;/STRONG&gt; it is not ideal, but can't quite figure out how to fix it. What I ultimately want is a numeric variable (Month_Enroll) that provides the number of months before or after the start date that a case is from. For example, if a hospital started in June 2018, I would want all cases from May 2018 to have a Month_Enroll of -1 and all cases from July 2017 to have a Month_Enroll of 1.&amp;nbsp; This data set is constantly be updated, so I am trying to write a program that will require minimum maintenance. I feel like I should be able to accomplish what I need with a DO Loop, but haven't been successful so far.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I have (it isn't working how I want). Delivery date = date a baby was born, record_id is affiliated with a hospital&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA Set.Clean;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FORMAT delivery_date&amp;nbsp; YYMMN6.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FORMAT Hospital_Start YYMMN6.;&lt;BR /&gt;&lt;BR /&gt;SET Set.Old;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Hospital_Start = 06/01/2018;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF FIND(record_id, "56073") THEN DO;&lt;BR /&gt;Month_Enroll = delivery_date - Luth_Start;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate any help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that SAS does not consider this to be a "date" value. I strongly suspect that this line of code creates a value you do not want.&lt;/P&gt;
&lt;PRE&gt;Hospital_Start = 06/01/2018;&lt;/PRE&gt;
&lt;P&gt;Hospitalstart will have a value of about 0.00297 because it is dividing 6 by 1 and then dividing that result by 2018.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To provide a DATE value that SAS will use as such you must use&lt;/P&gt;
&lt;PRE&gt;HospitalStart = '01JUN2018'D;&lt;/PRE&gt;
&lt;P&gt;A quoted value in Date9 or Date7 appearance followed by a D tells SAS you intend to use a DATE value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what you want is&lt;/P&gt;
&lt;PRE&gt;month_enroll = intck('month',hospital_start,delivery_date);&lt;/PRE&gt;
&lt;P&gt;Dates in SAS are measured in Days and regardless of the display format you will get a difference of Days with date1-date2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 23:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603726#M16980</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-12T23:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX or INTCK in DO Loop with no end date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603735#M16981</link>
      <description>&lt;P&gt;Welcome to the world of dates, that's one of the reasons that SAS expertise are so great.&amp;nbsp; They know how to look at dates and ask what are they really asking for based on what they are giving me.&amp;nbsp; Dates the world of programming.&amp;nbsp;&lt;EM&gt; 'Payments due, past dues, death because of inability for system to identify date and time of entry.'&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 01:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603735#M16981</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-11-13T01:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX or INTCK in DO Loop with no end date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603916#M17002</link>
      <description>Thank you so much! I know better...but my common sense seems to disappear when I am rage coding.</description>
      <pubDate>Wed, 13 Nov 2019 17:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603916#M17002</guid>
      <dc:creator>BlairWhitty</dc:creator>
      <dc:date>2019-11-13T17:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX or INTCK in DO Loop with no end date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603917#M17003</link>
      <description>Thank you so much for your expertise! This worked exactly as I wanted, you are truly a SAS god</description>
      <pubDate>Wed, 13 Nov 2019 17:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTNX-or-INTCK-in-DO-Loop-with-no-end-date/m-p/603917#M17003</guid>
      <dc:creator>BlairWhitty</dc:creator>
      <dc:date>2019-11-13T17:51:04Z</dc:date>
    </item>
  </channel>
</rss>

