<?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 remove extraneous dates from variables with multiple dates listed in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394764#M12003</link>
    <description>&lt;P&gt;First, I'd do a countw with the slash as separator. If it's five, separate the first 4 characters (substr) from the third word, and the next part from position 5, so you can then convert the parts to dates (input to convert to numeric and mdy to build the dates).&lt;/P&gt;</description>
    <pubDate>Mon, 11 Sep 2017 17:19:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-09-11T17:19:03Z</dc:date>
    <item>
      <title>How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394741#M12000</link>
      <description>&lt;P&gt;Howdy folks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This has been puzzling me for quite sometime now...I'm working with some very dirty data that came to me in the form of 41 Excel spreadsheets. One of the issues with this data is that some of the date values look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dt_inspect_hfh.PNG" style="width: 209px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14967i0B6DCC60FADD905A/image-size/large?v=v2&amp;amp;px=999" role="button" title="dt_inspect_hfh.PNG" alt="dt_inspect_hfh.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That 9/26/201310/7/13 looked like this in the original data file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.PNG" style="width: 122px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14968i36A7862347A45529/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Capture2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what I'm trying to figure out is - is there a way to remove everything in a variable value EXCEPT for the most recent date? That way all my single date values will remain the same, but all my multiple date values will only keep the most current and valid date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your time! I've tried searching for solutions to this but I think I'm just not using the right keywords.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 16:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394741#M12000</guid>
      <dc:creator>fwashburn</dc:creator>
      <dc:date>2017-09-11T16:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394749#M12001</link>
      <description>&lt;P&gt;Can you please type the values and not paste coz I am lazy to type in my SAS editor to write the program&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 17:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394749#M12001</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-11T17:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394752#M12002</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163476"&gt;@fwashburn&lt;/a&gt;&amp;nbsp;please post the data as text, not an image. We'd have to type out your data to work with it, but it's easier if you do that instead of us &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 17:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394752#M12002</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-11T17:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394764#M12003</link>
      <description>&lt;P&gt;First, I'd do a countw with the slash as separator. If it's five, separate the first 4 characters (substr) from the third word, and the next part from position 5, so you can then convert the parts to dates (input to convert to numeric and mdy to build the dates).&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 17:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394764#M12003</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-09-11T17:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394847#M12004</link>
      <description>&lt;P&gt;Is there absolute consistency? You show two variants:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Three Five words separated with slashes. When this happens, the field is always m/d/y, with each word a varying number of digits. This one is easy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Five words separated by slashes. In this case, the field appears to be m/d/x/d/y, with each word a varying number of digits. Words 1,2,4, and 5 are easy. Word 3 is easy, AS LONG AS THE YEAR IS ALWAYS FOUR DIGITS! You have cases in the other fields of a two-digit year. This will cause you huge problems.&lt;/P&gt;
&lt;P&gt;All I can think of is this (pseudo code)&lt;BR /&gt;IF length of field 3 is less than 3, THEN *error* /* can't make a year and a month out of two or fewer digits. */&lt;BR /&gt;ELSE IF first two digits of field 3 are '20' /* has to be a four digit date, unless your years can include 2020 */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN DO&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF length of field 3 is 5&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN take first four digits as year, fifth as month&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF length of field 3 is 6&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN take first four digits as year, fifth and sixth as month&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE *error* /* can't make any sense out of a 3-4 or 7 or above character field starting with '20' */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END&lt;BR /&gt;ELSE DO /* first two digits not 20, must be a two-digit year */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN DO&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF length of field 3 is 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN take first two digits as year, third as month&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF length of field 3 is 4&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN take first two digits as year, third and fourth as month&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE *error* /* can't make any sense out of a 5 or above character field not starting with '20' */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I'm highly doubtful. This looks like a huge unstructured data problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 18:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394847#M12004</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-09-11T18:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394849#M12005</link>
      <description>&lt;P&gt;If the Excel file had a CTRL+ENTER in the file and you convert it to CSV and read it in, I believe the return is kept.&lt;/P&gt;
&lt;P&gt;That would help parse the data and avoid other issues...possibly.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 18:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394849#M12005</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-11T18:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394902#M12011</link>
      <description>&lt;P&gt;You are correct; this is a huge unstructured data problem. I've been wracking my brain trying to figure out if there's any code that would force the values into uniformity but thinking that it may not be possible. I'll try out your code and report back; thanks for your response!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 21:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394902#M12011</guid>
      <dc:creator>fwashburn</dc:creator>
      <dc:date>2017-09-11T21:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394905#M12012</link>
      <description>&lt;P&gt;Unfortunately when I convert the file to a CSV format, it screws with a lot of the other data, so I haven't been able to do that successfully. Otherwise, that would be a great call!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 21:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394905#M12012</guid>
      <dc:creator>fwashburn</dc:creator>
      <dc:date>2017-09-11T21:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove extraneous dates from variables with multiple dates listed</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394911#M12014</link>
      <description>&lt;P&gt;Can you do a mass find and replace in the Excel fiel for all CTRL+ENTER values and change them to an asterisk or some other symbol that can be used to parse the data later on?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 21:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-remove-extraneous-dates-from-variables-with-multiple/m-p/394911#M12014</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-11T21:13:23Z</dc:date>
    </item>
  </channel>
</rss>

