<?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: converting character date to number and format isn't working in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/converting-character-date-to-number-and-format-isn-t-working/m-p/810188#M33831</link>
    <description>&lt;P&gt;The INFORMAT is incorrect, it needs to be the informat that matches how the data appears, basically it tells SAS how the variable appears and how it should be read in.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data shows as YYYY/MM/DD then it should be YYMMDD10.&lt;/P&gt;
&lt;P&gt;Note that this was one of the same issues in your previous question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vchange2;
set work.vchange;
hbv2 = input(hepb_date, YYMMDD10.);
format hbv2 yymmdd.;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am converting the date that shows up as yyyy/mm/dd in a character format to a numeric&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is what proc contents looks like for the original data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc contents data = work.vchange;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;Variable Type Len Format Informat Label&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;HepB_DAte&lt;/TD&gt;
&lt;TD&gt;Char&lt;/TD&gt;
&lt;TD&gt;10&lt;/TD&gt;
&lt;TD&gt;$10.&lt;/TD&gt;
&lt;TD&gt;$10.&lt;/TD&gt;
&lt;TD&gt;hepbdate&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and this is the code i am using to convert the data&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data vchange2;&lt;BR /&gt;set work.vchange;&lt;BR /&gt;hbv2 = input(hepb_date, 10.);&lt;BR /&gt;format hbv2 yymmdd.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and the error that comes up is:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NOTE: Invalid argument to function INPUT at line 71 column 8.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;HepB_DAte=2010/01/01&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;can someone help with this?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Apr 2022 15:10:08 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-04-27T15:10:08Z</dc:date>
    <item>
      <title>converting character date to number and format isn't working</title>
      <link>https://communities.sas.com/t5/New-SAS-User/converting-character-date-to-number-and-format-isn-t-working/m-p/810185#M33830</link>
      <description>&lt;P&gt;I am converting the date that shows up as yyyy/mm/dd in a character format to a numeric&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is what proc contents looks like for the original data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc contents data = work.vchange;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Variable Type Len Format Informat Label&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;HepB_DAte&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;$10.&lt;/TD&gt;&lt;TD&gt;$10.&lt;/TD&gt;&lt;TD&gt;hepbdate&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is the code i am using to convert the data&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data vchange2;&lt;BR /&gt;set work.vchange;&lt;BR /&gt;hbv2 = input(hepb_date, 10.);&lt;BR /&gt;format hbv2 yymmdd.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the error that comes up is:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NOTE: Invalid argument to function INPUT at line 71 column 8.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;HepB_DAte=2010/01/01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can someone help with this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/converting-character-date-to-number-and-format-isn-t-working/m-p/810185#M33830</guid>
      <dc:creator>Cooksam13</dc:creator>
      <dc:date>2022-04-27T15:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: converting character date to number and format isn't working</title>
      <link>https://communities.sas.com/t5/New-SAS-User/converting-character-date-to-number-and-format-isn-t-working/m-p/810188#M33831</link>
      <description>&lt;P&gt;The INFORMAT is incorrect, it needs to be the informat that matches how the data appears, basically it tells SAS how the variable appears and how it should be read in.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data shows as YYYY/MM/DD then it should be YYMMDD10.&lt;/P&gt;
&lt;P&gt;Note that this was one of the same issues in your previous question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vchange2;
set work.vchange;
hbv2 = input(hepb_date, YYMMDD10.);
format hbv2 yymmdd.;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347594"&gt;@Cooksam13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am converting the date that shows up as yyyy/mm/dd in a character format to a numeric&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is what proc contents looks like for the original data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc contents data = work.vchange;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;Variable Type Len Format Informat Label&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;HepB_DAte&lt;/TD&gt;
&lt;TD&gt;Char&lt;/TD&gt;
&lt;TD&gt;10&lt;/TD&gt;
&lt;TD&gt;$10.&lt;/TD&gt;
&lt;TD&gt;$10.&lt;/TD&gt;
&lt;TD&gt;hepbdate&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and this is the code i am using to convert the data&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data vchange2;&lt;BR /&gt;set work.vchange;&lt;BR /&gt;hbv2 = input(hepb_date, 10.);&lt;BR /&gt;format hbv2 yymmdd.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and the error that comes up is:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NOTE: Invalid argument to function INPUT at line 71 column 8.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;HepB_DAte=2010/01/01&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;can someone help with this?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/converting-character-date-to-number-and-format-isn-t-working/m-p/810188#M33831</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-04-27T15:10:08Z</dc:date>
    </item>
  </channel>
</rss>

