<?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 How to convert date character type to numeric? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-date-character-type-to-numeric/m-p/367562#M275376</link>
    <description>&lt;P&gt;hello everybody.&lt;/P&gt;&lt;P&gt;I want to convert&amp;nbsp;date character type&amp;nbsp;to numeric. I use a code which is shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Sampledata;
	set table01 table02;
	new_var = input(TRD_EVENT_DT,mmddyy10.);
	format new_var date9.;
	drop TRD_EVENT_DT;
	rename new_var = TRD_EVENT_DT;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The log file is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:36:35 TRD_STCK_CD=PNLZ1 TRD_PR=22200 TRD_TUROVR=2400 new_var=.
_ERROR_=1 _N_=1
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:37:17 TRD_STCK_CD=PNLZ1 TRD_PR=22210 TRD_TUROVR=50 new_var=.
_ERROR_=1 _N_=2
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:37:17 TRD_STCK_CD=PNLZ1 TRD_PR=22202 TRD_TUROVR=50 new_var=.
_ERROR_=1 _N_=3
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:38:09 TRD_STCK_CD=PNLZ1 TRD_PR=22230 TRD_TUROVR=500 new_var=.
_ERROR_=1 _N_=4
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:38:09 TRD_STCK_CD=PNLZ1 TRD_PR=22200 TRD_TUROVR=1434 new_var=.
_ERROR_=1 _N_=5
NOTE: Mathematical operations could not be performed at the following places. The results of the
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      17976342 at 938:15
NOTE: There were 10000000 observations read from the data set WORK.TABLE01.
NOTE: There were 7976342 observations read from the data set WORK.TABLE02.
NOTE: The data set WORK.SAMPLEDATA has 17976342 observations and 5 variables.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What is the problem?&lt;/P&gt;&lt;P&gt;How can I fix that?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 00:52:55 GMT</pubDate>
    <dc:creator>aminkarimid</dc:creator>
    <dc:date>2017-06-16T00:52:55Z</dc:date>
    <item>
      <title>How to convert date character type to numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-date-character-type-to-numeric/m-p/367562#M275376</link>
      <description>&lt;P&gt;hello everybody.&lt;/P&gt;&lt;P&gt;I want to convert&amp;nbsp;date character type&amp;nbsp;to numeric. I use a code which is shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Sampledata;
	set table01 table02;
	new_var = input(TRD_EVENT_DT,mmddyy10.);
	format new_var date9.;
	drop TRD_EVENT_DT;
	rename new_var = TRD_EVENT_DT;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The log file is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:36:35 TRD_STCK_CD=PNLZ1 TRD_PR=22200 TRD_TUROVR=2400 new_var=.
_ERROR_=1 _N_=1
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:37:17 TRD_STCK_CD=PNLZ1 TRD_PR=22210 TRD_TUROVR=50 new_var=.
_ERROR_=1 _N_=2
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:37:17 TRD_STCK_CD=PNLZ1 TRD_PR=22202 TRD_TUROVR=50 new_var=.
_ERROR_=1 _N_=3
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:38:09 TRD_STCK_CD=PNLZ1 TRD_PR=22230 TRD_TUROVR=500 new_var=.
_ERROR_=1 _N_=4
NOTE: Invalid argument to function INPUT at line 938 column 15.
TRD_EVENT_DT=2014-03-25 TRD_EVENT_TM=11:38:09 TRD_STCK_CD=PNLZ1 TRD_PR=22200 TRD_TUROVR=1434 new_var=.
_ERROR_=1 _N_=5
NOTE: Mathematical operations could not be performed at the following places. The results of the
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      17976342 at 938:15
NOTE: There were 10000000 observations read from the data set WORK.TABLE01.
NOTE: There were 7976342 observations read from the data set WORK.TABLE02.
NOTE: The data set WORK.SAMPLEDATA has 17976342 observations and 5 variables.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What is the problem?&lt;/P&gt;&lt;P&gt;How can I fix that?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 00:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-date-character-type-to-numeric/m-p/367562#M275376</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-06-16T00:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date character type to numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-date-character-type-to-numeric/m-p/367566#M275377</link>
      <description>&lt;P&gt;For starters your date looks like:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;TRD_EVENT_DT&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2014&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-03&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-25&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;While you've specified an informat of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;mmddyy10&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which is month, day, year. Yours is clearly yymmdd&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's possibly other issues, but you should probably fix&amp;nbsp;that first. &amp;nbsp;I would remove the rename until it works and then do it after. It's usually easier and cleaner IMO to rename the variable on input, create the new variable with the old name and then drop the old variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 01:05:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-date-character-type-to-numeric/m-p/367566#M275377</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-16T01:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert date character type to numeric?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-date-character-type-to-numeric/m-p/367567#M275378</link>
      <description>&lt;P&gt;use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_var = input(myvar,yymmdd10.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and do not forget to format as below or whatever you like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;format new_var mmddyy10.;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 01:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-date-character-type-to-numeric/m-p/367567#M275378</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-16T01:10:20Z</dc:date>
    </item>
  </channel>
</rss>

