<?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: Character Date Conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328560#M73361</link>
    <description>&lt;P&gt;Try defining the date columns in Excel as type DATE to begin with, then re-import.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jan 2017 20:04:27 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2017-01-30T20:04:27Z</dc:date>
    <item>
      <title>Character Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328502#M73349</link>
      <description>&lt;P&gt;I've imported an excel sheet into SAS EG using the import wizard and the date values are character values that look like 2013/03/01. I need to convert these to SAS Date values, but when I try to use input the values just come out as missing values. How can I properly convert these character dates to SAS date values? Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 16:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328502#M73349</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2017-01-30T16:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Character Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328506#M73350</link>
      <description>&lt;P&gt;You didn't show the code you used. The following, using the anydtdte informat worked for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  input date $10.;
  cards;
2013/03/01
2012/04/02
;
data want;
  set have (rename=(date=_date));
  format date date9.;
  date=input(_date,anydtdte10.);
run;
&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 16:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328506#M73350</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-30T16:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Character Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328560#M73361</link>
      <description>&lt;P&gt;Try defining the date columns in Excel as type DATE to begin with, then re-import.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 20:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328560#M73361</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-01-30T20:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Character Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328595#M73367</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;This does indeed turn it into a SAS date, however ultimately what I'm trying to do after the conversion is subset a dataset by an expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;                              
 select ID into :ID_List_2010 separated by ' '
 from EGTASK.'ID FROM DATES_UPDATED'n
 where from_date &amp;lt; '01jan2011'd;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it is giving me the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Expression using less than &amp;nbsp;(&amp;lt;) has components that are of different data types.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Sorry, I did not specify before that I wanted to do a condition on dates.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 21:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328595#M73367</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2017-01-30T21:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Character Date Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328602#M73370</link>
      <description>&lt;P&gt;I'd think that your log shows some other error before that. The following worked for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  input id $ date $10.;
  cards;
a 2013/03/01
b 2010/03/01
c 2010/04/02
;

data want;
  set have (rename=(date=_date));
  format from_date date9.;
  from_date=input(_date,anydtdte10.);
run;

proc sql noprint;                              
 select ID into :ID_List_2010 separated by ' '
   /* from EGTASK.'ID FROM DATES_UPDATED'n*/
   from want
     where from_date &amp;lt; '01jan2011'd
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 22:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Character-Date-Conversion/m-p/328602#M73370</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-30T22:10:24Z</dc:date>
    </item>
  </channel>
</rss>

