<?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 year date value from character to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512264#M137935</link>
    <description>&lt;P&gt;you could assign a length to the date2 like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;length date2 4.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set have;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Nov 2018 17:02:05 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2018-11-12T17:02:05Z</dc:date>
    <item>
      <title>convert year date value from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512258#M137932</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have the date1 value = 1978 i.e. all in 4 digits with informat and format of $64. I want to covert it to a numeric value with a format of year4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First I tried:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set have;&lt;/P&gt;
&lt;P&gt;if date2=input(date1,$64);&lt;/P&gt;
&lt;P&gt;format date2 year4.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It doesn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I remove the format statement it keeps the value as character as the original variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried date2=input(date1, year4.); and that doesn't work too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 16:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512258#M137932</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2018-11-12T16:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: convert year date value from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512262#M137934</link>
      <description>&lt;P&gt;There is no YEAR format or INFORMAT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Years don't need formats, if the year is 1978, everyone knows what that means and you don't need to change its appearance with a format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, you want to simply convert from character to numeric&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date2 = input(date1,4.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Nov 2018 17:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512262#M137934</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-12T17:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: convert year date value from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512264#M137935</link>
      <description>&lt;P&gt;you could assign a length to the date2 like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;length date2 4.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set have;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 17:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512264#M137935</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-12T17:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: convert year date value from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512267#M137937</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 17:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512267#M137937</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2018-11-12T17:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: convert year date value from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512268#M137938</link>
      <description>&lt;P&gt;And will remember that.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 17:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-year-date-value-from-character-to-numeric/m-p/512268#M137938</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2018-11-12T17:04:56Z</dc:date>
    </item>
  </channel>
</rss>

