<?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 Perl Regular Expression simple case in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242430#M45001</link>
    <description>&lt;P&gt;I would like to convert variable 'res'&amp;nbsp;into numeric. But I would like to do it &amp;nbsp;for the records that &amp;nbsp;only have digit value ( in our case it is &amp;nbsp;12.3 ). So I used a perl regular expression. But &amp;nbsp;I have tried&amp;nbsp;write an expression so that the returned value of prxmatch is equal to 0 for 12.3 and non zero for other cases. &amp;nbsp;It doesn work...Any clue ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SasKap&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input res $20.;
 p=prxparse("/\&amp;lt;\&amp;gt;\+\D/");
 pos=prxmatch(p,res);

put var= p= pos=;
cards;
12.3
&amp;lt;5
&amp;gt;9
+5
unknown
;

run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Jan 2016 18:32:02 GMT</pubDate>
    <dc:creator>saskapa</dc:creator>
    <dc:date>2016-01-08T18:32:02Z</dc:date>
    <item>
      <title>Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242430#M45001</link>
      <description>&lt;P&gt;I would like to convert variable 'res'&amp;nbsp;into numeric. But I would like to do it &amp;nbsp;for the records that &amp;nbsp;only have digit value ( in our case it is &amp;nbsp;12.3 ). So I used a perl regular expression. But &amp;nbsp;I have tried&amp;nbsp;write an expression so that the returned value of prxmatch is equal to 0 for 12.3 and non zero for other cases. &amp;nbsp;It doesn work...Any clue ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SasKap&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input res $20.;
 p=prxparse("/\&amp;lt;\&amp;gt;\+\D/");
 pos=prxmatch(p,res);

put var= p= pos=;
cards;
12.3
&amp;lt;5
&amp;gt;9
+5
unknown
;

run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jan 2016 18:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242430#M45001</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-01-08T18:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242444#M45004</link>
      <description>&lt;P&gt;Why is +5 not a number? I would do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
if not p then p + prxparse("/^[+-]?\d+\.?\d*/");
input res $20.;
pos=prxmatch(p,res);
put res= pos=;
cards;
12.3
&amp;lt;5
&amp;gt;9
+5
unknown
-123
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jan 2016 19:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242444#M45004</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-01-08T19:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242497#M45017</link>
      <description>&lt;P&gt;What would you like for your final output for that example? I'm not sure how you are going to use the 0 result.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 23:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242497#M45017</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-08T23:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242650#M45053</link>
      <description>&lt;P&gt;Why not use ?? operator ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input res $20.;
pos=input(res,?? best32.);
* input res ?? best32. ;
put res= pos=;
cards;
12.3
&amp;lt;5
&amp;gt;9
+5
unknown
-123
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2016 05:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242650#M45053</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-11T05:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242748#M45086</link>
      <description>Hi PG,&lt;BR /&gt;&lt;BR /&gt;Thanks. Could you please explain me what does \ ^[+-]? , \.? and \d* perform ?</description>
      <pubDate>Mon, 11 Jan 2016 16:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242748#M45086</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-01-11T16:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242750#M45088</link>
      <description>I would like to convert res into numeric. Unfortunately there are values that cant be converted to numeric, so if  I run a perl function to identify the one that can be converted into numeric ( pos =0) than I'll run an input statement on it this value.    saskap</description>
      <pubDate>Mon, 11 Jan 2016 16:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242750#M45088</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-01-11T16:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242754#M45091</link>
      <description>Thanks Ksharp. Could you please explain me  '??' ?  Is it just  everything that is numeric only ?</description>
      <pubDate>Mon, 11 Jan 2016 16:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242754#M45091</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-01-11T16:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242777#M45098</link>
      <description>&lt;P&gt;The ?? suppresses error messages when reading non-numeric values and does not set the automatic _ERROR_ variable to 1.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 18:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242777#M45098</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-11T18:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242839#M45104</link>
      <description>&lt;P&gt;Someone has already answer your question. But I think the best way to understand it is to check SAS documnetation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;y=input(x, ?? best.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;==&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;y=input(x, ? best.);&lt;/P&gt;
&lt;P&gt;_error_=1;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 01:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242839#M45104</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-12T01:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242886#M45123</link>
      <description>&lt;P&gt;Thanks. I have checked first the help documentation before raising the question but I could not find any answer. The only answer when typing '?' &amp;nbsp;in the index search from help doc , was about greplay procedure....Nothing as well with google..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Saskap&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 10:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/242886#M45123</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-01-12T10:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Regular Expression simple case</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/243000#M45147</link>
      <description>&lt;P&gt;You would find the answer under INPUT function&amp;nbsp;in the documentation.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 18:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-Regular-Expression-simple-case/m-p/243000#M45147</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-12T18:25:10Z</dc:date>
    </item>
  </channel>
</rss>

