<?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 Date Extract in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-Extract/m-p/722588#M224074</link>
    <description>&lt;P&gt;I have a variable with dates in different formats and ranges.&amp;nbsp; The first one is pretty simple.&amp;nbsp; Looking for a way to scan and extract text for the latest date from the other variations&amp;nbsp; so that I end up with the dates in Want and the Format. Please advise. Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl66" style="height: 14.5pt; width: 48pt;"&gt;Have&lt;/TD&gt;
&lt;TD width="82px" class="xl67" style="border-left: none; width: 48pt;"&gt;Want&lt;/TD&gt;
&lt;TD width="102.667px" class="xl66" style="border-left: none; width: 48pt;"&gt;Format&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;Jan 9, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180109&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;April 19,20,25, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180425&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;June 7 &amp;amp; 11, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180611&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;July 4 - 16, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180716&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;Feb 26 - Mar 7, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180307&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Mon, 01 Mar 2021 14:33:25 GMT</pubDate>
    <dc:creator>AP718</dc:creator>
    <dc:date>2021-03-01T14:33:25Z</dc:date>
    <item>
      <title>Date Extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Extract/m-p/722588#M224074</link>
      <description>&lt;P&gt;I have a variable with dates in different formats and ranges.&amp;nbsp; The first one is pretty simple.&amp;nbsp; Looking for a way to scan and extract text for the latest date from the other variations&amp;nbsp; so that I end up with the dates in Want and the Format. Please advise. Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl66" style="height: 14.5pt; width: 48pt;"&gt;Have&lt;/TD&gt;
&lt;TD width="82px" class="xl67" style="border-left: none; width: 48pt;"&gt;Want&lt;/TD&gt;
&lt;TD width="102.667px" class="xl66" style="border-left: none; width: 48pt;"&gt;Format&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;Jan 9, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180109&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;April 19,20,25, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180425&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;June 7 &amp;amp; 11, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180611&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;July 4 - 16, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180716&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="78px" height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;Feb 26 - Mar 7, 2018&lt;/TD&gt;
&lt;TD width="82px" align="right" class="xl65" style="border-top: none; border-left: none;"&gt;20180307&lt;/TD&gt;
&lt;TD width="102.667px" class="xl65" style="border-top: none; border-left: none;"&gt;YYMMDDN8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 01 Mar 2021 14:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Extract/m-p/722588#M224074</guid>
      <dc:creator>AP718</dc:creator>
      <dc:date>2021-03-01T14:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date Extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Extract/m-p/722595#M224077</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Have $ 20. Want yymmdd10.	Format $ 10.;
format Want yymmddn8.;
cards;
Jan 9, 2018	         20180109	YYMMDDN8
April 19,20,25, 2018 20180425	YYMMDDN8
June 7 &amp;amp; 11, 2018    20180611	YYMMDDN8
July 4 - 16, 2018    20180716	YYMMDDN8
Feb 26 - Mar 7, 2018 20180307	YYMMDDN8
;
run;


data want;
  set have;
  length m $ 3;

  m = scan(compress(Have,,'KAS'), -1);
  y = scan(Have, -1);
  d = scan(Have, -2);

  want_new = input(cats(d,m,y), date9.);
  format want_new yymmddn8.;

  compare = (want_new = want);
run;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 15:00:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Extract/m-p/722595#M224077</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-03-01T15:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date Extract</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-Extract/m-p/722635#M224099</link>
      <description>Thank you! This worked to convert the dates!</description>
      <pubDate>Mon, 01 Mar 2021 17:40:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-Extract/m-p/722635#M224099</guid>
      <dc:creator>AP718</dc:creator>
      <dc:date>2021-03-01T17:40:44Z</dc:date>
    </item>
  </channel>
</rss>

