<?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: Difference in days between two dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-days-between-two-dates/m-p/442205#M110605</link>
    <description>&lt;P&gt;You forgot the SET statement in your data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA NBA_DURATION;
        set NBA;
	fecha = intck('day', DATE, "01Jan2000"d); 
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 05 Mar 2018 01:01:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-03-05T01:01:05Z</dc:date>
    <item>
      <title>Difference in days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-days-between-two-dates/m-p/442202#M110604</link>
      <description>&lt;P&gt;I am trying to calculate the difference in days between dates. More specifically between the values of variable Date and January 1, 2000.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it is my code and I have attached the data set:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC IMPORT OUT= work.NBA&lt;BR /&gt;	DATAFILE= "/folders/myfolders/NBA60.txt"&lt;BR /&gt;	DBMS=CSV REPLACE;&lt;BR /&gt;	DELIMITER=',';&lt;BR /&gt;	GETNAMES=YES;&lt;BR /&gt;RUN; &lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA=work.NBA;&lt;BR /&gt;RUN; &lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = NBA;&lt;BR /&gt;	FORMAT Date WORDDATE. ;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;DATA NBA;&lt;BR /&gt;	fecha = intck('day', DATE, "01Jan2000"d); &lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA=NBA;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 00:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-in-days-between-two-dates/m-p/442202#M110604</guid>
      <dc:creator>Miah</dc:creator>
      <dc:date>2018-03-05T00:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-days-between-two-dates/m-p/442205#M110605</link>
      <description>&lt;P&gt;You forgot the SET statement in your data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA NBA_DURATION;
        set NBA;
	fecha = intck('day', DATE, "01Jan2000"d); 
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 01:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-in-days-between-two-dates/m-p/442205#M110605</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T01:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in days between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-days-between-two-dates/m-p/442206#M110606</link>
      <description>&lt;P&gt;Your data has some dates before year 2000, and some after.&amp;nbsp; So when you calculate the difference, which years should show a negative difference and which a positive difference?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your formula calculates the number of days as negative for years after 2000.&amp;nbsp; It's easy to reverse that, and you don't need any functions to do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fecha = date - '01jan2000'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, you do need a SET statement.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 01:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-in-days-between-two-dates/m-p/442206#M110606</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-05T01:08:12Z</dc:date>
    </item>
  </channel>
</rss>

