<?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 use of substr with date time data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140395#M37525</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how do I extract year out of the below data ...sbstr gives this error&lt;/P&gt;&lt;P&gt;ERROR: Function SUBSTR requires a character expression as argument 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D_O_ADMN_DT &lt;BR /&gt;25JAN1932:00:00:00.000 &lt;BR /&gt;17NOV1971:00:00:00.000 &lt;BR /&gt;29OCT1975:00:00:00.000 &lt;BR /&gt;29OCT1975:00:00:00.000 &lt;BR /&gt;04MAR1932:00:00:00.000 &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql ;&lt;BR /&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT substr(c.D_O_ADMN_DT,6,4) from sasdata.casedata c;&lt;BR /&gt;ERROR: Function SUBSTR requires a character expression as argument 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Jan 2014 05:35:16 GMT</pubDate>
    <dc:creator>robm</dc:creator>
    <dc:date>2014-01-14T05:35:16Z</dc:date>
    <item>
      <title>use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140395#M37525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how do I extract year out of the below data ...sbstr gives this error&lt;/P&gt;&lt;P&gt;ERROR: Function SUBSTR requires a character expression as argument 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D_O_ADMN_DT &lt;BR /&gt;25JAN1932:00:00:00.000 &lt;BR /&gt;17NOV1971:00:00:00.000 &lt;BR /&gt;29OCT1975:00:00:00.000 &lt;BR /&gt;29OCT1975:00:00:00.000 &lt;BR /&gt;04MAR1932:00:00:00.000 &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql ;&lt;BR /&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT substr(c.D_O_ADMN_DT,6,4) from sasdata.casedata c;&lt;BR /&gt;ERROR: Function SUBSTR requires a character expression as argument 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 05:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140395#M37525</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2014-01-14T05:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140396#M37526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; A SAS datetime value is stored in a numeric variable and represented as the number of seconds since 1/1/1960. You then apply a SAS format to make this number human readable. The format as such does not change the internal value but how it's printed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below code illustrates the principle: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt; dt=datetime();&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt; select &lt;BR /&gt;&amp;nbsp; dt format=best16.,&lt;BR /&gt;&amp;nbsp; dt format=datetime21.,&lt;BR /&gt;&amp;nbsp; dt format=dtyear4.,&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* applies the format, then stores the resulting string in the new variable "year" */&lt;BR /&gt;&amp;nbsp; put(dt,dtyear4.) as year&lt;BR /&gt; from have&lt;BR /&gt; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 06:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140396#M37526</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-01-14T06:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140397#M37527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;shouldn't this work then?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql ;&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT year(c.D_O_ADMN_DT) from sasdata.casedata c;&lt;/P&gt;&lt;P&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;/P&gt;&lt;P&gt;NOTE: Invalid argument to function YEAR. Missing values may be generated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 07:34:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140397#M37527</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2014-01-14T07:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140398#M37528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi robm,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Year function will work to extract year from datetime/date variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;format a datetime.;&lt;/P&gt;&lt;P&gt;a=0;&lt;/P&gt;&lt;P&gt;yr=year(a);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think u r variable might be in character format.Check once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 10:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140398#M37528</guid>
      <dc:creator>KarthikSrivasthav</dc:creator>
      <dc:date>2014-01-14T10:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140399#M37529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Karthik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The argument of the Year function is a date (not a datetime) so the correct use of the function would be as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format a datetime.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; a=datetime();&lt;/P&gt;&lt;P&gt;&amp;nbsp; yr=year(&lt;STRONG&gt;datepart&lt;/STRONG&gt;(a));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 14:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140399#M37529</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-01-14T14:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140400#M37530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;SELECT year(datepart(c.D_O_ADMN_DT)) from sasdata.casedata c;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 14:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140400#M37530</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-01-14T14:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140401#M37531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks CTorres&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; year(datepart(c.D_O_ADMN_DT))&amp;gt;=&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;startDate.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; year(datepart(c.D_O_ADMN_DT))&amp;lt;=&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;endDate.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'Y'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;seems to give &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;967&lt;/P&gt;&lt;P&gt;968&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Mark case records where the patient has a case between the start/endDates */&lt;/P&gt;&lt;P&gt;969&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;970&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table a.&amp;amp;ir._tab01 as&lt;/P&gt;&lt;P&gt;971&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select p.P_ACTIVE_CLINIC,&lt;/P&gt;&lt;P&gt;972&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p.P_PATIENT_NUMBER, c.C_CASE_NUMBER, p.P_D_O_LAST_UPDATE format yymmdd10. as patLastUpd,&lt;/P&gt;&lt;P&gt;973&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p.P_D_O_DEATH format yymmdd10., c.C_D_O_ADMN format yymmdd10.,&lt;/P&gt;&lt;P&gt;974&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p.P_POSTAL_CODE, c.C_POSTAL_CODE, c.C_RES_PROV_CODE, p.P_PROVINCE format = $provid.,&lt;/P&gt;&lt;P&gt;975&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c.C_RESIDENCE_CODE,&lt;/P&gt;&lt;P&gt;976&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; substr(c.C_PATIENT_NUMBER,6,2) || substr(c.C_PATIENT_NUMBER,4,2) ||&lt;/P&gt;&lt;P&gt;976 ! substr(c.C_PATIENT_NUMBER,2,2) || substr(c.C_PATIENT_NUMBER,1,1) as sortseq,&lt;/P&gt;&lt;P&gt;977&lt;/P&gt;&lt;P&gt;978&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case&lt;/P&gt;&lt;P&gt;979&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when year(datepart(c.D_O_ADMN_DT))&amp;gt;=&amp;amp;startDate. and&lt;/P&gt;&lt;P&gt;979 ! year(datepart(c.D_O_ADMN_DT))&amp;lt;=&amp;amp;endDate. then 'Y'&lt;/P&gt;&lt;P&gt;980&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else ' '&lt;/P&gt;&lt;P&gt;981&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end as insideRange&lt;/P&gt;&lt;P&gt;982&lt;/P&gt;&lt;P&gt;983&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sasdata.casedata c, sasdata.patient p&lt;/P&gt;&lt;P&gt;984&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where c.C_PATIENT_NUMBER = p.P_PATIENT_NUMBER&lt;/P&gt;&lt;P&gt;985&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and c.C_ADMISSION_TYPE = '12'&lt;/P&gt;&lt;P&gt;986&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;987&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;hey that's great thanks Torres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 04:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140401#M37531</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2014-01-15T04:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140402#M37532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use san &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;scan(do_admn_dt,1,': ')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 06:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140402#M37532</guid>
      <dc:creator>TarunKumar</dc:creator>
      <dc:date>2014-01-15T06:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140403#M37533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="816958" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"scan()" is like "substr()" a string function and you would face the same issues as described in the initial post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 06:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140403#M37533</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-01-15T06:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140404#M37534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;scan(do_admn_dt,1,': ')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;do_admn_dt&lt;/SPAN&gt;_year =input(substr(&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;scan(compress(do_admn_dt),1,': ')&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;,6,4&lt;/SPAN&gt;),9.2);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 07:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140404#M37534</guid>
      <dc:creator>TarunKumar</dc:creator>
      <dc:date>2014-01-15T07:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140405#M37535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="816958" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You're missing that this is about extracting the year part out of a SAS datetime value - which is stored as a numeric value and not a character value. "Substr()", "scan()" and "compress()" are functions for character values dealing with strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To extract the year out of the numeric variable "dt" containing as SAS datetime value you can either use something like&amp;nbsp; "year(datepart(dt))" which will return the year as a four digit numeric value, or you can use something like "put(dt,dtyear4.)" which will return the year as a four digit string (character value).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 08:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140405#M37535</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-01-15T08:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140406#M37536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why does this seem so difficult?&lt;/P&gt;&lt;P&gt;If the original var is string then the substr() would NOT have caused the error message.&lt;/P&gt;&lt;P&gt;since the numeric value has the presentation style of a datetime value I assume the internal value is a datetime. &lt;/P&gt;&lt;P&gt;to create a string from a numeric like this we use a put() function. The function uses a format to choose the presentation style. The format to present just the year of a datetime value is DTYEAR.&lt;/P&gt;&lt;P&gt;YEAR_STRING= PUT( D_O_ADMN_DT, DTYEAR4. ) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 08:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140406#M37536</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-01-15T08:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140407#M37537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry Patrick&lt;/P&gt;&lt;P&gt;you posted while I was searching for a DTYEAR function&lt;/P&gt;&lt;P&gt;Don't think my post adds anything.&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 08:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140407#M37537</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-01-15T08:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140408#M37538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Three comments:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. For your program to work correctly the macrovariables &amp;amp;startDate and &amp;amp;endDate should contain a 4 digit year, not a full date.&lt;/P&gt;&lt;P&gt;2. I think the expression "year(datepart(c.D_O_ADMN_DT))&amp;gt;=&amp;amp;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;startDate.&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; year(datepart(c.D_O_ADMN_DT))&amp;lt;=&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;endDate.&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;'Y'&lt;/SPAN&gt;"&amp;nbsp; is not the one causing the three errors.&lt;/P&gt;&lt;P&gt;3. I would guess the formats you are applying to the variables "&lt;STRONG&gt;p.P_D_O_LAST_UPDATE&lt;/STRONG&gt; format yymmdd10. as patLastUpd,&lt;STRONG&gt; p.P_D_O_DEATH&lt;/STRONG&gt; format yymmdd10., c.&lt;STRONG&gt;C_D_O_ADMN&lt;/STRONG&gt; format yymmdd10.," are those causing the errors. Check if they are character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 13:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140408#M37538</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-01-15T13:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140409#M37539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi C &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yup &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;amp;startDate and &amp;amp;endDate&lt;/SPAN&gt; are a 4 digit year # assigned like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let startDate = 2007;&lt;/P&gt;&lt;P&gt;%let endDate = 2009 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is what I get from &lt;/P&gt;&lt;P&gt;proc sql; &lt;/P&gt;&lt;P&gt;select p.P_D_O_LAST_UPDATE&amp;nbsp; from sasdata.casedata c, sasdata.patient p&lt;/P&gt;&lt;P&gt;where c.C_PATIENT_NUMBER = p.P_PATIENT_NUMBER&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; and c.C_ADMISSION_TYPE ^= '12'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so it looks like a date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure SQL: Query Results"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="l data"&gt;199511 8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="l data"&gt;199511 8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="l data"&gt;199511 8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="l data"&gt;199511 8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="l data"&gt;199511 2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="l data"&gt;199511 2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 14:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140409#M37539</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2014-01-15T14:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140410#M37540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, they look like a date but Character or Numeric?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this to get the attributes of the variable .P_D_O_LAST_UPDATE :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select name, type, length, label, format, informat&lt;/P&gt;&lt;P&gt;&amp;nbsp; from sashelp.vcolumn&lt;/P&gt;&lt;P&gt;&amp;nbsp; where libname = 'SASDATA'&lt;/P&gt;&lt;P&gt;&amp;nbsp; and memname = 'PATIENT'&lt;/P&gt;&lt;P&gt;&amp;nbsp; and name = 'P_D_O_LAST_UPDATE'&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 15:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140410#M37540</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-01-15T15:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140411#M37541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you see&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; padding-left: 30px;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;year(datepart(c.D_O_ADMN_DT))&amp;gt;=&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #008080;"&gt;startDate.&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #0000ff;"&gt;and&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; padding-left: 30px;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #0000ff;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New';"&gt;year(datepart(c.D_O_ADMN_DT))&amp;lt;=&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #008080;"&gt;endDate.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #800080;"&gt;'Y'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; padding-left: 30px;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #800080;"&gt;seems to give&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; padding-left: 30px;"&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try handling the year as a string:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; padding-left: 30px;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;put(c.D_O_ADMN_DT, dtyear4.)&amp;gt;="&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #008080;"&gt;startDate."&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #0000ff;"&gt;and&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff; padding-left: 30px;"&gt;&lt;SPAN style="font-size: 10pt; font-weight: inherit; font-style: inherit; font-family: 'Courier New';"&gt;put(c.D_O_ADMN_DT, dtyear4.)&amp;lt;="&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #008080;"&gt;endDate."&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-weight: inherit; font-style: inherit; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #0000ff;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-weight: inherit; font-style: inherit; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-weight: inherit; font-style: inherit; font-family: 'Courier New'; color: #800080;"&gt;'Y'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;of course, you could half the process time for the put() conversion by changing your &lt;SPAN style="color: #0000ff;"&gt;WHEN&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; font-size: 9pt; font-family: 'Courier New'; color: black; background-color: white;"&gt; &lt;/SPAN&gt;clause to:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 9pt; font-family: 'Courier New'; color: blue; background-color: white;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; font-size: 9pt; font-family: 'Courier New'; color: black; background-color: white;"&gt; put(c.D_O_ADMN_DT, &lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; font-size: 9pt; font-family: 'Courier New'; color: teal; background-color: white;"&gt;dtyear4.&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; font-size: 9pt; font-family: 'Courier New'; color: black; background-color: white;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; between &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;startYEAR."&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;endYEAR."&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'Y'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;this depends on &amp;amp;startYEAR and &amp;amp;endYEAR being 4digit year strings and column D_O_ADMN_DT being a standard SAS numeric datetime value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Message was edited by: Peter Crawford reviewing this - more questions surface -----&amp;gt;&lt;/P&gt;&lt;P&gt;why would you SUBSTR( patient_NUMBER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if that is a numeric number ) ?&lt;/P&gt;&lt;P&gt;if that is a number, you first need to convert it to a string with the usual &lt;/P&gt;&lt;P&gt;PUT( ) substr( PUT( PATIENT_NUMBER, {suitable format} &lt;/P&gt;&lt;P&gt;However, what format should be used?&lt;/P&gt;&lt;P&gt;Have all patient_number the same number of digits - should there be leading zeroes or should the conversion suppress leading zeroes?&lt;/P&gt;&lt;P&gt;Is there already a special format for patient_number?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 11:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140411#M37541</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2014-01-23T11:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140412#M37542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;looks like its a string ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P_D_O_LAST_UPDATE char 8 P_D_O_LAST_UPDATE $8. $8. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Jan 2014 19:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140412#M37542</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2014-01-26T19:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140413#M37543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;now i get &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;ERROR: Character expression requires a character format.&lt;/P&gt;&lt;P&gt;ERROR: Expression using greater than or equal (&amp;gt;=) has components that are of different data types.&lt;/P&gt;&lt;P&gt;ERROR: Expression using less than or equal (&amp;lt;=) has components that are of different data types.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Jan 2014 19:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140413#M37543</guid>
      <dc:creator>robm</dc:creator>
      <dc:date>2014-01-26T19:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: use of substr with date time data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140414#M37544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is not with your datetime variable D_O_ADMN_DT, bu with the character variables P_D_O_LAST_UPDATE, P_D_O_DEATH and C_D_O_ADMN.&amp;nbsp; The error message appears three times because you are attempting to attach the numeric format YYMMDD10. to these three character variables.&lt;/P&gt;&lt;P&gt;You could leave them as character and remove the "format yymmdd10." parts of the query and the errors will go away.&lt;/P&gt;&lt;P&gt;If you want to convert these character strings into actual dates then you will need to do a little work as SAS will not like the embedded blanks that you showed in the example values for P_D_O_LAST_UPDATE.&amp;nbsp; To convert them to actual dates could do something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;input(translate(p.P_D_O_LAST_UPDATE,'0',' '),yymmdd8.) format yymmdd10. as patLastUpd,&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Jan 2014 20:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/use-of-substr-with-date-time-data/m-p/140414#M37544</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-01-26T20:42:40Z</dc:date>
    </item>
  </channel>
</rss>

