<?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: Informat for date in the form MM.YYYY in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326575#M72750</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Day' does not really matter; it can be taken as 01.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just need to read a file which will have month and year for a particular event.&lt;/P&gt;&lt;P&gt;As I mentioned, ANYDTDTE7. works fine with hyphen or slash as separators, that is, the following code gives expected output as &lt;STRONG&gt;10.2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;informat dte anydtdte7.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;format dte mmyyp7.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input dte;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;put dte;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;10/2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Taking 10-2016 in place of 10/2016 also works; but unfortunately, my input will be as 10.2016, which gives a missing value as output.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 22 Jan 2017 13:38:17 GMT</pubDate>
    <dc:creator>ShagilImam</dc:creator>
    <dc:date>2017-01-22T13:38:17Z</dc:date>
    <item>
      <title>Informat for date in the form MM.YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326564#M72742</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What informat shall I use to input a date in the form MM.YYYY (period as separator). Example: March 2016 is represented as 03.2016.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ANYDTDTE7. works when hyphen (-) or slash (/) are used as separators. Returns a missing value when period is used as a separtor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 11:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326564#M72742</guid>
      <dc:creator>ShagilImam</dc:creator>
      <dc:date>2017-01-22T11:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Informat for date in the form MM.YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326571#M72747</link>
      <description>&lt;P&gt;Dates in SAS refer to a particular day. &amp;nbsp;If you have just the month and year (in any format), you first need to decide what day of the month to use in order to convert your data to a SAS date.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 13:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326571#M72747</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-22T13:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Informat for date in the form MM.YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326575#M72750</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Day' does not really matter; it can be taken as 01.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just need to read a file which will have month and year for a particular event.&lt;/P&gt;&lt;P&gt;As I mentioned, ANYDTDTE7. works fine with hyphen or slash as separators, that is, the following code gives expected output as &lt;STRONG&gt;10.2016&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;informat dte anydtdte7.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;format dte mmyyp7.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input dte;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;put dte;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;10/2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Taking 10-2016 in place of 10/2016 also works; but unfortunately, my input will be as 10.2016, which gives a missing value as output.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 13:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326575#M72750</guid>
      <dc:creator>ShagilImam</dc:creator>
      <dc:date>2017-01-22T13:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Informat for date in the form MM.YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326576#M72751</link>
      <description>&lt;P&gt;In that case, you might have to work around the problem by reading as text then changing "." to "/":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input textvar&amp;nbsp;$;&lt;/P&gt;
&lt;P&gt;dte&amp;nbsp;= input( translate(textvar, '/', '.'), anydtdte7.);&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 13:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326576#M72751</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-22T13:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Informat for date in the form MM.YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326590#M72761</link>
      <description>&lt;P&gt;Just for the fun you may even do (code tested and is ok):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;input date best7.4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;date = input('01'||put(date*10000,z6.),ddmmyy8.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; format date ddmmyy10.;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;03.2017&lt;/P&gt;
&lt;P&gt;11.2016&lt;/P&gt;
&lt;P&gt;5.1999&lt;/P&gt;
&lt;P&gt;; run;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 17:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326590#M72761</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-01-22T17:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Informat for date in the form MM.YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326609#M72769</link>
      <description>&lt;P&gt;You can read an external file directly if you redefine the value to read on the fly, and add the missing day :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue mmyyp (default=10)
          's/(.{7})/01.\1/o' (regexpe)=[ddmmyy10.];
run;

data WANT;
  input DATE mmyyp.;
  putlog DATE= date9. ;
cards;
03.2016
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;DATE=01MAR2016&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More examples about all valid SAS regular expressions, including their use in informats, by following this link:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 22:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Informat-for-date-in-the-form-MM-YYYY/m-p/326609#M72769</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-01-22T22:16:09Z</dc:date>
    </item>
  </channel>
</rss>

