<?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: pull date from character field in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576326#M163113</link>
    <description>&lt;P&gt;If the set of words is alpanumeric,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This deals with &lt;STRONG&gt;delim&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input abc $30.;
cards;
final.case_20190712
final.incident_20190405
final.abcd_20190405
final.trans_tarn_20190406
final.incident
;
 
data want;
set have;
k=findc(abc,'_','b');
if k&amp;gt;0 then date=substr(abc,k+1);
drop k;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 18:50:55 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-07-24T18:50:55Z</dc:date>
    <item>
      <title>pull date from character field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576319#M163108</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to extract only distinct date from the below character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable abc&lt;/P&gt;
&lt;P&gt;has below values and wanted to extract only 3 below distinct dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;final.case_&lt;STRONG&gt;20190712&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;final.incident_&lt;STRONG&gt;20190405&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;final.abcd_20190405&lt;/P&gt;
&lt;P&gt;final.trans_tarn_&lt;STRONG&gt;20190406&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;final.incident&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 18:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576319#M163108</guid>
      <dc:creator>shuchidxt_gmail_com</dc:creator>
      <dc:date>2019-07-24T18:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: pull date from character field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576325#M163112</link>
      <description>Seems like those are the only numbers so you can consider using COMPRESS with the 'kd' modifiers to keep only digits and then use INPUT() to convert that a numeric SAS date.</description>
      <pubDate>Wed, 24 Jul 2019 18:47:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576325#M163112</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-24T18:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: pull date from character field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576326#M163113</link>
      <description>&lt;P&gt;If the set of words is alpanumeric,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This deals with &lt;STRONG&gt;delim&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input abc $30.;
cards;
final.case_20190712
final.incident_20190405
final.abcd_20190405
final.trans_tarn_20190406
final.incident
;
 
data want;
set have;
k=findc(abc,'_','b');
if k&amp;gt;0 then date=substr(abc,k+1);
drop k;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 18:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576326#M163113</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-24T18:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: pull date from character field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576332#M163115</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/27156"&gt;@shuchidxt_gmail_com&lt;/a&gt;&amp;nbsp; Oh you want &lt;STRONG&gt;distinct&lt;/STRONG&gt; dates&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select distinct ifc(findc(abc,'_','b')&amp;gt;0,substr(abc,findc(abc,'_','b')+1),' ') as dates
from have
having dates&amp;gt;' ';
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jul 2019 18:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576332#M163115</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-24T18:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: pull date from character field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576334#M163116</link>
      <description>&lt;P&gt;Thanks All. it worked&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 19:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576334#M163116</guid>
      <dc:creator>shuchidxt_gmail_com</dc:creator>
      <dc:date>2019-07-24T19:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: pull date from character field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576547#M163206</link>
      <description>&lt;P&gt;Just for fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input abc $30.;
temp=scan(abc,-1,'_');
if prxmatch('/^\d{8}$/',strip(temp)) then want=temp;
cards;
final.case_20190712
final.incident_20190405
final.abcd_20190405
final.trans_tarn_20190406
final.incident
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jul 2019 12:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pull-date-from-character-field/m-p/576547#M163206</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-25T12:15:05Z</dc:date>
    </item>
  </channel>
</rss>

