<?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: create a substract ing variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441489#M110461</link>
    <description>&lt;P&gt;Subtracting&amp;nbsp; strings is not possible. You have to convert the strings to sas dates using input function. You should check why those "dates" have not been converted to sas dates during data import.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data coolDates;
   set have(rename=(appDate=strAppDate sepDate=strSepDate));

   length appDate sepDate 8;
   format appDate sepDate yymmdds10.;

   appDate = input(strAppDate, yymmdd10.);
   sepDate = input(strSepDate, yymmdd10.);

   /* Calculations ...*/

   drop strAppDate strSepDate;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Mar 2018 08:17:25 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2018-03-02T08:17:25Z</dc:date>
    <item>
      <title>create a substract ing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441473#M110457</link>
      <description>&lt;P&gt;I'd like to create a variable called "Length of stay" by subtracting the separation date (sepdate) from the admit date (addate) in the hosp file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;addate= 2008-10--25&lt;/P&gt;&lt;P&gt;sepdate=2008-11-18&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I wrote :&lt;/P&gt;&lt;P&gt;data hosp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set hosp;&lt;/P&gt;&lt;P&gt;los= sepdate - addate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it&amp;nbsp;does not work.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 07:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441473#M110457</guid>
      <dc:creator>madan68</dc:creator>
      <dc:date>2018-03-02T07:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: create a substract ing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441489#M110461</link>
      <description>&lt;P&gt;Subtracting&amp;nbsp; strings is not possible. You have to convert the strings to sas dates using input function. You should check why those "dates" have not been converted to sas dates during data import.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data coolDates;
   set have(rename=(appDate=strAppDate sepDate=strSepDate));

   length appDate sepDate 8;
   format appDate sepDate yymmdds10.;

   appDate = input(strAppDate, yymmdd10.);
   sepDate = input(strSepDate, yymmdd10.);

   /* Calculations ...*/

   drop strAppDate strSepDate;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Mar 2018 08:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441489#M110461</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-03-02T08:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: create a substract ing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441499#M110463</link>
      <description>Make sure sepdate and addate are both Numeric Data Type to have numeric operations.&lt;BR /&gt;If not Numeric then convert them to Numeric using informat.&lt;BR /&gt;Everything else looks ok.</description>
      <pubDate>Fri, 02 Mar 2018 08:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441499#M110463</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-03-02T08:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: create a substract ing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441532#M110485</link>
      <description>&lt;P&gt;"does not work" is a&amp;nbsp;&lt;STRONG&gt;VERY POOR&lt;/STRONG&gt; description of your problem. Supply the log, and give a&amp;nbsp;&lt;EM&gt;clear&lt;/EM&gt; description how the result you got does not meet your expectations. Don't force us to pry important information out of your nose.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 10:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-substract-ing-variables/m-p/441532#M110485</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-02T10:55:40Z</dc:date>
    </item>
  </channel>
</rss>

