<?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 solve the below issue? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647438#M193786</link>
    <description>thanks mam, it is working</description>
    <pubDate>Wed, 13 May 2020 12:10:21 GMT</pubDate>
    <dc:creator>annypanny</dc:creator>
    <dc:date>2020-05-13T12:10:21Z</dc:date>
    <item>
      <title>How to solve the below issue?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647398#M193763</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;
&lt;P&gt;The below code is running fine for this type of range "&lt;U&gt;2040-42&lt;/U&gt;" but when I used "&lt;U&gt;2040-2042&lt;/U&gt;", then the code is not returning anything. Can anyone help me in this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data have;
	infile datalines dlm="," dsd;
	input Sc_no $ Strategy $ Collection_name :$20.;
	datalines;
A0007,FLEXI,"Flexi 2035-37 (BLK)"
A0008,FLEXI,"itl      2037-39 (BLK)"
A0009,FLEXI,"cptl   2040-42 (BLK)"
A0010,FLEXI,"sen   2038-40 (BLK)"
;
run;

data want;
	set have;
	_low_bound  = prxchange('s/^.*(\d{2}\d{2})-\d{2}.*$/$1/i',1,Collection_name);
	_high_bound = prxchange('s/^.*(\d{2})\d{2}-(\d{2}).*$/$1$2/i',1,Collection_name);;
	if _low_bound &amp;lt;= year(today())+20 &amp;lt;= _high_bound then output;
	drop _:;
run;&lt;/LI-CODE&gt;
&lt;P&gt;Thanks in Advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 10:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647398#M193763</guid>
      <dc:creator>annypanny</dc:creator>
      <dc:date>2020-05-13T10:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve the below issue?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647411#M193770</link>
      <description>&lt;P&gt;Read and learn about Perl Regular Expressions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="," dsd;
	input Sc_no $ Strategy $ Collection_name :$30.;
	datalines;
A0007,FLEXI,"Flexi 2035-2037 (BLK)"
A0008,FLEXI,"itl      2037-2039 (BLK)"
A0009,FLEXI,"cptl   2040-2042 (BLK)"
A0010,FLEXI,"sen   2038-2040 (BLK)"
;
run;

data want;
	set have;
	_low_bound  = prxchange('s/^.*(\d{4})-(\d{4}).*$/$1/i',1,Collection_name);
	_high_bound = prxchange('s/^.*(\d{4})-(\d{4}).*$/$2/i',1,Collection_name);;
	if _low_bound &amp;lt;= year(today())+20 &amp;lt;= _high_bound then output;
	drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 11:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647411#M193770</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-05-13T11:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve the below issue?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647423#M193779</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/316738"&gt;@annypanny&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have adapted the code to take into account this situation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="," dsd;
	input Sc_no $ Strategy $ Collection_name :$40.;
	datalines;
A0007,FLEXI,"Flexi 2035-37 (BLK)"
A0008,FLEXI,"itl      2037-39 (BLK)"
A0009,FLEXI,"cptl   2040-42 (BLK)"
A0010,FLEXI,"sen   2038-40 (BLK)"
A0010,FLEXI,"sen   2038-2042 (BLK)"
;
run;

data want;
	set have;
	_low_bound  = prxchange('s/^.*(\d{2}\d{2})-\d{2}.*$/$1/i',1,Collection_name);
	
	/*Second year in format yy e.g. 2038-42 */
	if prxmatch('/^.*(\d{2})\d{2}-(\d{2})\D*$/i',Collection_name) then
		_high_bound = prxchange('s/^.*(\d{2})\d{2}-(\d{2}).*$/$1$2/i',1,Collection_name);

	/*Second year in format yyyy e.g. 2038-2042 */
	else if prxmatch('/^.*(\d{2})\d{2}-(\d{4})\D*$/i',Collection_name) then
		_high_bound = prxchange('s/^.*(\d{2})\d{2}-(\d{4}).*$/$2/i',1,Collection_name);
	
	if _low_bound &amp;lt;= year(today())+20 &amp;lt;= _high_bound then output;
	
	drop _:;
run;

proc print;&lt;/CODE&gt;&lt;/PRE&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="Capture d’écran 2020-05-13 à 13.46.13.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39370i2601D6A9F7706992/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-05-13 à 13.46.13.png" alt="Capture d’écran 2020-05-13 à 13.46.13.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 11:46:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647423#M193779</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-13T11:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve the below issue?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647438#M193786</link>
      <description>thanks mam, it is working</description>
      <pubDate>Wed, 13 May 2020 12:10:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-the-below-issue/m-p/647438#M193786</guid>
      <dc:creator>annypanny</dc:creator>
      <dc:date>2020-05-13T12:10:21Z</dc:date>
    </item>
  </channel>
</rss>

