<?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: Date format informat in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637847#M189652</link>
    <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;.</description>
    <pubDate>Mon, 06 Apr 2020 13:47:53 GMT</pubDate>
    <dc:creator>sahoositaram555</dc:creator>
    <dc:date>2020-04-06T13:47:53Z</dc:date>
    <item>
      <title>Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637665#M189549</link>
      <description>&lt;P&gt;Hi SAS experts,&lt;/P&gt;&lt;P&gt;I have a data&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;21APR2004&lt;BR /&gt;18JUL1981&lt;BR /&gt;umfeb2007&lt;BR /&gt;UMUMK1968&lt;BR /&gt;umumkumk&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;How can I create output like this?&lt;/P&gt;&lt;P&gt;2004-04-21&lt;/P&gt;&lt;P&gt;1981-07-18&lt;/P&gt;&lt;P&gt;2007-02&lt;/P&gt;&lt;P&gt;1968&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for any help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 10:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637665#M189549</guid>
      <dc:creator>art_srap</dc:creator>
      <dc:date>2020-04-05T10:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637671#M189554</link>
      <description>&lt;P&gt;Is the 'invalid date text' always 'um'?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 10:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637671#M189554</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-04-05T10:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637672#M189555</link>
      <description>&lt;P&gt;'um' and 'umk'&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 11:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637672#M189555</guid>
      <dc:creator>art_srap</dc:creator>
      <dc:date>2020-04-05T11:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637675#M189556</link>
      <description>&lt;P&gt;Is "um" always the indicator for a missing date, and "umk" the indicator for a missing month and missing year? Or can they be interchangeable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other problem you face is that the desired output, if it is to be a column of dates, can't accommodate actual dates like 2004-04-21, and year-month like 2007-02 and year only like 1968 in the same column. Now, if you want it as a column of text strings, then the problem is simple, but you don't make it clear if the output is a column of SAS dates (which are numeric) or if the output is text strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 12:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637675#M189556</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-05T12:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637677#M189557</link>
      <description>&lt;P&gt;Thanks for the reply. It could be as a column of text strings if it's a way to get this output.&lt;BR /&gt;About "um" and "umk"&amp;nbsp; yes, I have only this data in this task.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 12:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637677#M189557</guid>
      <dc:creator>art_srap</dc:creator>
      <dc:date>2020-04-05T12:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637678#M189558</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    datechar = transtrn(upcase(datechar),'UMK','');
    datechar = transtrn(upcase(datechar),'UM','');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This assumes you have a character variable named DATECHAR&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 13:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637678#M189558</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-05T13:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637688#M189564</link>
      <description>&lt;P&gt;Thank you. I got this output.&amp;nbsp;&lt;A href="https://prnt.sc/rtgk4a" target="_blank"&gt;https://prnt.sc/rtgk4a&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's no way to get like this?&amp;nbsp;&amp;nbsp;&lt;A href="https://prnt.sc/rtgn9n" target="_blank"&gt;https://prnt.sc/rtgn9n&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 14:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637688#M189564</guid>
      <dc:creator>art_srap</dc:creator>
      <dc:date>2020-04-05T14:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637691#M189567</link>
      <description>&lt;P&gt;Check if it is a valid date.&amp;nbsp; If not check if making the first two characters 01 make it a date, otherwise read the last 4 characters as the year.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input have $9. ;
  date=input(have,??date9.);
  if not missing(date) then want=put(date,yymmdd10.);
  else do;
    date=input(tranwrd(upcase(have),'UM','01'),??date9.);
    if not missing(date) then want=put(date,yymmd7.);
    else do;
      date=input(substr(have,6),??4.);
      if 1800 &amp;lt; date &amp;lt;= 9999 then want=put(date,4.);
    end;
  end;
  drop date;
cards;
21APR2004
18JUL1981
umfeb2007
UMUMK1968
umumkumk
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs      have       want

 1     21APR2004    2004-04-21
 2     18JUL1981    1981-07-18
 3     umfeb2007    2007-02
 4     UMUMK1968    1968
 5     umumkumk

&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Apr 2020 14:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637691#M189567</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-05T14:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637695#M189570</link>
      <description>&lt;P&gt;It's valid,thanks a lot.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 14:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637695#M189570</guid>
      <dc:creator>art_srap</dc:creator>
      <dc:date>2020-04-05T14:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637711#M189584</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302775"&gt;@art_srap&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you. I got this output.&amp;nbsp;&lt;A href="https://prnt.sc/rtgk4a" target="_blank" rel="noopener"&gt;https://prnt.sc/rtgk4a&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's no way to get like this?&amp;nbsp;&amp;nbsp;&lt;A href="https://prnt.sc/rtgn9n" target="_blank" rel="noopener"&gt;https://prnt.sc/rtgn9n&lt;/A&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just a comment for your future reference. I'm not going to click on those links. Just copy and paste (as text) the output you get into your reply (click on the &amp;lt;/&amp;gt; icon before doing the paste)&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 20:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637711#M189584</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-05T20:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637736#M189600</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, could you please specify the reason behind the logic.May i please have a reason for using 9999 as a upper cutoff?&lt;BR /&gt;if 1800 &amp;lt; date &amp;lt;= 9999 then want=put(date,4.);</description>
      <pubDate>Sun, 05 Apr 2020 21:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637736#M189600</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-04-05T21:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637743#M189607</link>
      <description>The ?? prevents invalid strings from generating errors.  Invalid strings will result in missing values.&lt;BR /&gt;&lt;BR /&gt;You can pick any reasonable year range limits you want.  9999 is the largest number that can by represented by 4 digits. Also the largest year that the date format can present.  There was just another post today where someone was using from/to dates to represents time periods when data was current and they were using year of 9999 to represent values that are still actively being used.</description>
      <pubDate>Sun, 05 Apr 2020 22:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637743#M189607</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-05T22:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637847#M189652</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;.</description>
      <pubDate>Mon, 06 Apr 2020 13:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/637847#M189652</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2020-04-06T13:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Date format informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/638777#M189967</link>
      <description>&lt;P&gt;Dear Tom,&lt;BR /&gt;Is it possible to achieve same result without tranwrd (without removing 'UM' or other letters)? I need to have a dynamic code.&lt;BR /&gt;I started to solve on this way , but it didn't work yet. Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data task_1;&lt;BR /&gt;input date: $9. ;&lt;/P&gt;&lt;P&gt;day=substr(date,1,2);&lt;BR /&gt;month=substr(date,3,3);&lt;BR /&gt;year=substr(date,6,4);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (day) then day1=day;&lt;BR /&gt;if (year) then year1=year;&lt;BR /&gt;month1=put(month,3.);&lt;BR /&gt;if (month) then month1=month;&lt;BR /&gt;newdate=cats(year1,month1,day1);&lt;/P&gt;&lt;P&gt;datalines;&lt;BR /&gt;21APR2004&lt;BR /&gt;18JUL1981&lt;BR /&gt;umfeb2007&lt;BR /&gt;UMUMK1968&lt;BR /&gt;umumkumk&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 19:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-informat/m-p/638777#M189967</guid>
      <dc:creator>art_srap</dc:creator>
      <dc:date>2020-04-09T19:12:35Z</dc:date>
    </item>
  </channel>
</rss>

