<?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: Convert Character date value to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816304#M322183</link>
    <description>&lt;P&gt;To convert a&amp;nbsp;&lt;EM&gt;date&lt;/EM&gt; string to a&amp;nbsp;&lt;EM&gt;date&lt;/EM&gt;, you must use a&amp;nbsp;&lt;EM&gt;date&lt;/EM&gt; informat. BEST. is for "normal" numbers and interprets digits, commas, periods, and scientific notation, but not dates or times.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;	
ORIG_STOP_SHIP = input('3/25/2022',mmddyy10.);
EXT_STOP_SHIP = input('4/24/2022',mmddyy10.);
format ORIG_STOP_SHIP EXT_STOP_SHIP mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hint: for consistent readability of code, do not use tabs. Only use blanks for whitespace and indentation (except in DATALINES, when you want to use 09x as delimiter).&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2022 09:57:06 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-06-03T09:57:06Z</dc:date>
    <item>
      <title>Convert Character date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816301#M322181</link>
      <description>&lt;P&gt;In my program we've date values like&amp;nbsp;3/25/2022 and&amp;nbsp;04/24/2082 in two different fields from the excel. After executing the similar step as shown below in my program, it is producing the values like 03/26/2082 and 04/25/2082 in the result. Excepted result is same value as input (03/25/2022) but with SAS date format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excel which we're using was mess, so we've converted all the fields to character and then reading it from excel. I could not succeed with the below program if I tried to replicate the same step by passing the hardcoded value in the input function. Any help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;	
	ORIG_STOP_SHIP = input('3/25/2022',best.);
	EXT_STOP_SHIP = input('4/24/2022',best.);
	format ORIG_STOP_SHIP EXT_STOP_SHIP  mmddyy10.;
run;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jun 2022 09:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816301#M322181</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2022-06-03T09:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816304#M322183</link>
      <description>&lt;P&gt;To convert a&amp;nbsp;&lt;EM&gt;date&lt;/EM&gt; string to a&amp;nbsp;&lt;EM&gt;date&lt;/EM&gt;, you must use a&amp;nbsp;&lt;EM&gt;date&lt;/EM&gt; informat. BEST. is for "normal" numbers and interprets digits, commas, periods, and scientific notation, but not dates or times.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;	
ORIG_STOP_SHIP = input('3/25/2022',mmddyy10.);
EXT_STOP_SHIP = input('4/24/2022',mmddyy10.);
format ORIG_STOP_SHIP EXT_STOP_SHIP mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hint: for consistent readability of code, do not use tabs. Only use blanks for whitespace and indentation (except in DATALINES, when you want to use 09x as delimiter).&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 09:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816304#M322183</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-03T09:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816305#M322184</link>
      <description>&lt;P&gt;As far as your conversion of character strings to SAS dates, you have to use the proper informat, which in this case is the MMDDYY informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;	
	ORIG_STOP_SHIP = input('3/25/2022',mmddyy10.);
	EXT_STOP_SHIP = input('4/24/2022',mmddyy10.);
	format ORIG_STOP_SHIP EXT_STOP_SHIP  mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general, converting Excel dates to SAS dates involves subtracting about 60 years. You can use your favorite internet search engine to find the details.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 09:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816305#M322184</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-03T09:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Character date value to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816333#M322192</link>
      <description>&lt;P&gt;As an aside: dealing with dates from Excel you may want to consider investigating if the entire column is the same type before any "import" if reading directly from Excel. I have received data in Excel that mixes of Excel date values and strings. Which can behave poorly if "imported".&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 14:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Character-date-value-to-numeric/m-p/816333#M322192</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-03T14:36:53Z</dc:date>
    </item>
  </channel>
</rss>

