<?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 char dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113745#M259192</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a column in my table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alphabetic List of Variables and Attributes&amp;nbsp; &lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp; Variable&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Len&amp;nbsp;&amp;nbsp;&amp;nbsp; Format&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Informat&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; MNDATE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Char&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $26.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $26.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when I try to do,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; (tab1.mndate - tab2.mndate )&amp;nbsp; as duration&amp;nbsp;&amp;nbsp; ......&amp;nbsp; ........&amp;nbsp; ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it says , cant subtract char...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What should I do to substract the dates.... ?&amp;nbsp; (&amp;nbsp; I cannot change my column type...)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Experts please help....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Oct 2013 09:25:04 GMT</pubDate>
    <dc:creator>VijayKumar</dc:creator>
    <dc:date>2013-10-16T09:25:04Z</dc:date>
    <item>
      <title>char dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113745#M259192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a column in my table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alphabetic List of Variables and Attributes&amp;nbsp; &lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp; Variable&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Len&amp;nbsp;&amp;nbsp;&amp;nbsp; Format&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Informat&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; MNDATE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Char&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $26.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $26.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when I try to do,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; (tab1.mndate - tab2.mndate )&amp;nbsp; as duration&amp;nbsp;&amp;nbsp; ......&amp;nbsp; ........&amp;nbsp; ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it says , cant subtract char...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What should I do to substract the dates.... ?&amp;nbsp; (&amp;nbsp; I cannot change my column type...)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Experts please help....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2013 09:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113745#M259192</guid>
      <dc:creator>VijayKumar</dc:creator>
      <dc:date>2013-10-16T09:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: char dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113746#M259193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt; background: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;Create a&amp;nbsp;&amp;nbsp; new variable of calendar date from the char date. Then do the calculations and then drop the calendar date.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt; background: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;data tab1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;set tab1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;day=substr(MINDATE&lt;/SPAN&gt;,1,2);&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;month=substr(MINDATE&lt;/SPAN&gt;,4,2);&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;year=substr(MINDATE&lt;/SPAN&gt;,7,4);&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;data tab1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt; background: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;set tab1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;day1=day*1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;month1=month*1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;year1=year*1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;drop day year month;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif;"&gt;set tab1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New';"&gt;Date1=input(catx('/',day1,month1,year1),ddmmyy10.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New';"&gt;format Date1 ddmmyy10.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New';"&gt;drop date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2013 10:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113746#M259193</guid>
      <dc:creator>Mit</dc:creator>
      <dc:date>2013-10-16T10:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: char dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113747#M259194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select(input(tab1.mndate,MMDDYY10.) - input(tab2.mndate,MMDDYY10.)) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This assumes that is the correct informat; you may need a different one, or even a datetime, in which case you would need datepart(input... ) - datepart(input...) if you want days not seconds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2013 14:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113747#M259194</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-10-16T14:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: char dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113748#M259195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per the proc content screenshot, we believe the date is in character format. In order to perform the calculation on the date, we need to convert the date to numeric, so we need to read the date in numeric format, you can use the informat anydtdte. to read the date converting it to sas date value on which you can perform the calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The interesting thing about this informat anydtdte. is that it can read any type of date whether mmddyy or ddmmyy or any other. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use it in the following way similar to snoopy369, just change the format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select(input(tab1.mndate,anydtdte.) - input(tab2.mndate,anydtdte.)) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2013 14:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/char-dates/m-p/113748#M259195</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-10-16T14:31:25Z</dc:date>
    </item>
  </channel>
</rss>

