<?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: How to read  date values containing Unknown characters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/534737#M146785</link>
    <description>How to convert unk from 01/unk/1976 in date format</description>
    <pubDate>Tue, 12 Feb 2019 07:30:06 GMT</pubDate>
    <dc:creator>Sritheja</dc:creator>
    <dc:date>2019-02-12T07:30:06Z</dc:date>
    <item>
      <title>How to read  date values containing Unknown characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290000#M59939</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my data, the date variables values contain the following values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;date1&lt;/P&gt;
&lt;P&gt;12/May/2015&lt;/P&gt;
&lt;P&gt;UN/UNK/2004&lt;BR /&gt;UN/Aug/2000&lt;BR /&gt;un/UNK/2001&lt;BR /&gt;10/UNK/2008&lt;BR /&gt;un/Mar/2003&lt;BR /&gt;un/UNK/un&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output needed&lt;/P&gt;
&lt;P&gt;2015-05-12&lt;/P&gt;
&lt;P&gt;2004&lt;/P&gt;
&lt;P&gt;2000-08&lt;/P&gt;
&lt;P&gt;2001&lt;/P&gt;
&lt;P&gt;2008--10&lt;/P&gt;
&lt;P&gt;2003-03&lt;/P&gt;
&lt;P&gt;blank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to read the date1 values to get the output. Thanks Please help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2016 04:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290000#M59939</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2016-08-07T04:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: hoe to read  date values containing Unknown chracters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290001#M59940</link>
      <description>&lt;P&gt;How were the solutions provided two weeks ago to the same question inadequate?&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2016 00:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290001#M59940</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-08-07T00:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: hoe to read  date values containing Unknown chracters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290004#M59942</link>
      <description>&lt;P&gt;Thanks for the hint&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68272"&gt;@knveraraju91﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I've already spent time for a solution to your question but I've now realized that you A) already asked this question before and B) don't give a lot of feedback and/or mark questions as answered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So waiting until you've done your bit before posting anything.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2016 01:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290004#M59942</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-08-07T01:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: hoe to read  date values containing Unknown chracters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290007#M59943</link>
      <description>&lt;PRE&gt;
I still remember there are many people have already answered your question. 
Wouldn't those code work for you ?



data have;
input date1 $20.;
cards;
12/May/2015
UN/UNK/2004
UN/Aug/2000
un/UNK/2001
10/UNK/2008
un/Mar/2003
un/UNK/un
;
run;

proc format;
invalue mon(upcase)
 'JAN'=1
 'FEB'=2
 'MAR'=3
 'APR'=4
 'MAY'=5
 'JUN'=6
 'JUL'=7
 'AUG'=8
 'SEP'=9
 'OCT'=10
 'NOV'=11
 'DEC'=12;
run;
data want;
 set have;
 length want $ 20;
 temp=prxchange('s/unk?//i',-1,date1);
 x=scan(temp,-1,'/','m');
 want=catx('-',want,x);
 x=scan(temp,-2,'/','m');
 want=catx('-',want,put(input(x,mon.),z2.));
 x=scan(temp,-3,'/','m');
 want=catx('-',want,x);
 want=translate(want,' ','.');
drop x temp;
run;


&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Aug 2016 03:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/290007#M59943</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-07T03:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to read  date values containing Unknown characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/534737#M146785</link>
      <description>How to convert unk from 01/unk/1976 in date format</description>
      <pubDate>Tue, 12 Feb 2019 07:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/534737#M146785</guid>
      <dc:creator>Sritheja</dc:creator>
      <dc:date>2019-02-12T07:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to read  date values containing Unknown characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/534774#M146800</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261409"&gt;@Sritheja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't post new questions to an old existing thread but open a new question and eventually reference the old discussion as a link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To answer your question:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A date must be a specific day in the calendar and "unk" doesn't give you such information. For this reason you can't logically convert such a string to a date unless you make a business decision to what "unk" should translate (i.e. to January or to July....).&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 11:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-date-values-containing-Unknown-characters/m-p/534774#M146800</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-02-12T11:30:40Z</dc:date>
    </item>
  </channel>
</rss>

