<?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 date when one date column has NA in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Difference-in-date-when-one-date-column-has-NA/m-p/445594#M13757</link>
    <description>&lt;P&gt;Are the dates SAS dates, ie numeric with a format such as yymmdd or are they character variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If they're character you first have to convert them to a number/numeric to do calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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/199134"&gt;@StarMan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to compute the difference in dates based on the date values in two columns and store the results in a third column. The dataset I have looks like this below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  Id      Col1_Date          Col2_Date
  1       2009-09-10         1916-02-29
  1       2009-09-10         NA&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The expected output should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  Id      Col1_Date          Col2_Date      Date_Diff
  1       2009-09-10         1916-02-29     93.6
  1       2009-09-10         NA             NA&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have tried a simple DataSet as shown below, but this is not working. I am not seeing any values in Date_Diff column.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  DATA  WORK.DF1 ;
  SET   WORK.DF1 ;
  FORMAT DOB date10.;
  Date_Diff = Col1_Date - Col2.Date;
  RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any help or suggestions on achieving this is much appreciated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Mar 2018 19:13:00 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-03-14T19:13:00Z</dc:date>
    <item>
      <title>Difference in date when one date column has NA</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Difference-in-date-when-one-date-column-has-NA/m-p/445592#M13756</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to compute the difference in dates based on the date values in two columns and store the results in a third column. The dataset I have looks like this below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  Id      Col1_Date          Col2_Date
  1       2009-09-10         1916-02-29
  1       2009-09-10         NA&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The expected output should be&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  Id      Col1_Date          Col2_Date      Date_Diff
  1       2009-09-10         1916-02-29     93.6
  1       2009-09-10         NA             NA&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have tried a simple DataSet as shown below, but this is not working. I am not seeing any values in Date_Diff column.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  DATA  WORK.DF1 ;
  SET   WORK.DF1 ;
  FORMAT DOB date10.;
  Date_Diff = Col1_Date - Col2.Date;
  RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help or suggestions on achieving this is much appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 19:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Difference-in-date-when-one-date-column-has-NA/m-p/445592#M13756</guid>
      <dc:creator>StarMan</dc:creator>
      <dc:date>2018-03-14T19:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in date when one date column has NA</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Difference-in-date-when-one-date-column-has-NA/m-p/445594#M13757</link>
      <description>&lt;P&gt;Are the dates SAS dates, ie numeric with a format such as yymmdd or are they character variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If they're character you first have to convert them to a number/numeric to do calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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/199134"&gt;@StarMan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to compute the difference in dates based on the date values in two columns and store the results in a third column. The dataset I have looks like this below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  Id      Col1_Date          Col2_Date
  1       2009-09-10         1916-02-29
  1       2009-09-10         NA&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The expected output should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  Id      Col1_Date          Col2_Date      Date_Diff
  1       2009-09-10         1916-02-29     93.6
  1       2009-09-10         NA             NA&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have tried a simple DataSet as shown below, but this is not working. I am not seeing any values in Date_Diff column.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  DATA  WORK.DF1 ;
  SET   WORK.DF1 ;
  FORMAT DOB date10.;
  Date_Diff = Col1_Date - Col2.Date;
  RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any help or suggestions on achieving this is much appreciated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 19:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Difference-in-date-when-one-date-column-has-NA/m-p/445594#M13757</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-14T19:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in date when one date column has NA</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Difference-in-date-when-one-date-column-has-NA/m-p/445598#M13758</link>
      <description>&lt;P&gt;Great ... but you haven't told us what you do see so we can compare it to the expected output. We need that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a potential source of problems, your syntax is wrong here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Date_Diff = Col1_Date - Col2.Date;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It should say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Date_Diff = Col1_Date - Col2_Date;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 19:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Difference-in-date-when-one-date-column-has-NA/m-p/445598#M13758</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-14T19:15:32Z</dc:date>
    </item>
  </channel>
</rss>

