<?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: What am I doing wrong as Date output shows not proper. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238695#M43853</link>
    <description>&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2015 14:55:48 GMT</pubDate>
    <dc:creator>a_k93</dc:creator>
    <dc:date>2015-12-10T14:55:48Z</dc:date>
    <item>
      <title>What am I doing wrong as Date output shows not proper.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238685#M43850</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below code when executed gives&lt;/P&gt;&lt;P&gt;**********&lt;/P&gt;&lt;P&gt;data ds_dtcon;&lt;BR /&gt;mydt='01/01/01';&lt;BR /&gt;mynumdt = input(mydt,ddmmyy10.);&lt;BR /&gt;format mynumdt ddmmyy10.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;**********&lt;/P&gt;&lt;P&gt;Output&lt;/P&gt;&lt;P&gt;mydt = 01/01/01&lt;/P&gt;&lt;P&gt;mynumdt = 01/01/2001&lt;/P&gt;&lt;P&gt;**********&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the same code as shown below when executed with different date pattern it shows wrong date output.&lt;/P&gt;&lt;P&gt;data ds_dtcon1;&lt;BR /&gt;mydt='01/jan/2001';&lt;BR /&gt;mynumdt = input(mydt,date9.);&lt;BR /&gt;format mynumdt date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;**********&lt;/P&gt;&lt;P&gt;Output&lt;/P&gt;&lt;P&gt;mydt = 01/jan/2001&lt;/P&gt;&lt;P&gt;mynumdt = 01JAN&lt;STRONG&gt;2020&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;**********&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidance is appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 13:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238685#M43850</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2015-12-10T13:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing wrong as Date output shows not proper.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238688#M43851</link>
      <description>&lt;P&gt;The problem lies here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mynumdt = input(mydt, date9.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The instruction "date9." tells SAS to read only 9 characters of MYDT.&amp;nbsp; It isn't reading the last two characters.&amp;nbsp; Switch to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mynumdt = input(mydt, date11.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 14:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238688#M43851</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-12-10T14:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing wrong as Date output shows not proper.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238695#M43853</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 14:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238695#M43853</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2015-12-10T14:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing wrong as Date output shows not proper.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238732#M43872</link>
      <description>&lt;P&gt;I got confused because of below code&amp;nbsp; where for &lt;STRONG&gt;Informat mydt date7.&lt;/STRONG&gt; is mentioned and still it gives proper output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ds_conv;&lt;BR /&gt;input mydt;&lt;BR /&gt;informat mydt date7.;&lt;BR /&gt;format mydt date9.;&lt;BR /&gt;datalines;&lt;BR /&gt;10-Jan-2014&lt;BR /&gt;10-dec-2003&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238732#M43872</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2015-12-10T16:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing wrong as Date output shows not proper.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238745#M43875</link>
      <description>&lt;P&gt;Input behaves differently with assigned informat, your example code, and informat in line.&lt;/P&gt;
&lt;P&gt;Run this code and see what happens:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ds_conv;
format mydt date9.;
input mydt date7.;
datalines;
10-Jan-2014
10-dec-2003
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your original use of the input function with wrong value is like the above code not like the example that worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 18:08:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238745#M43875</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-10T18:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing wrong as Date output shows not proper.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238751#M43877</link>
      <description>&lt;P&gt;Thanks BallardW for the knowledge sharing and reply. The output shows ' . ' (period) incase of inline informat. I am newbie and learning, if possible can you share any links to read more on these topic.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 18:37:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/238751#M43877</guid>
      <dc:creator>a_k93</dc:creator>
      <dc:date>2015-12-10T18:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing wrong as Date output shows not proper.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/239011#M43938</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Regarding&amp;nbsp;the INPUT &lt;EM&gt;statement&lt;/EM&gt; (as opposed to the INPUT &lt;EM&gt;function&lt;/EM&gt;), I think it's most important to know the differences between &lt;STRONG&gt;list input&lt;/STRONG&gt; and &lt;STRONG&gt;formatted input&lt;/STRONG&gt;, which are two of the four different&amp;nbsp;styles of reading raw data with the INPUT statement (the other two are called &lt;STRONG&gt;column input&lt;/STRONG&gt; and &lt;STRONG&gt;named input&lt;/STRONG&gt;, the latter being only rarely used, at least in my experience).&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;These are described in the &lt;/SPAN&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000146292.htm" target="_blank" rel="nofollow"&gt;online documentation on the INPUT statement&lt;/A&gt;&lt;SPAN&gt; and in more detailed pages which are linked there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;The&amp;nbsp;INFORMAT Statement&amp;nbsp;can be used to perform so called &lt;EM&gt;modified list input&lt;/EM&gt; (but there is another, I think more frequently used way to do this, see the above documentation on list input). This is explained in section "How SAS Treats Variables when You Assign Informats with the INFORMAT Statement" of the &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000178244.htm" target="_blank"&gt;documentation on the INFORMAT Statement&lt;/A&gt;. There you find the explanation why you were able to read dates such as&amp;nbsp;&lt;SPAN&gt;10-Jan-2014 with the "too short" date7. informat in the INFORMAT statement: The width 7 is simply ignored in this case! (See third bullet point of that section.)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000180357.htm" target="_blank"&gt;INPUT function&lt;/A&gt;&amp;nbsp;shares some&amp;nbsp;features with &lt;EM&gt;formatted input&lt;/EM&gt; (see above). In particular, specifying an informat with a sufficient length is important.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 22:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-wrong-as-Date-output-shows-not-proper/m-p/239011#M43938</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-12-11T22:45:08Z</dc:date>
    </item>
  </channel>
</rss>

