<?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 extract specific 4 digits from large string where the location varies in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360341#M274641</link>
    <description>&lt;P&gt;Or to do it differently:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if prxmatch("/\b(19|20)\d\d\b/o",PRECLINICAL) then
  PRECDATE2 = prxchange("s/.*\b((19|20)\d\d)\b.*/$1/o",1,PRECLINICAL);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 May 2017 23:33:00 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2017-05-21T23:33:00Z</dc:date>
    <item>
      <title>How to extract specific 4 digits from large string where the location varies</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360224#M274638</link>
      <description>&lt;P&gt;I want to extract year (4 digits) from a string which alphanumeric. The location of the year&amp;nbsp;varies.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The field name is 'Preclinical' that holds the string. Typical example of the string is &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"In SHR, po doses of 1-10mg/kg produced an antihypertensive effect of gradual onset and sustained (&amp;gt;7hr) duration due to peripheral vasodilation. It also showed suppression of the pressor response to cold stress, due to presynaptic action on the sympathetic nerve (Company communication, Fujirebio, Mar 1995). Tachycardia and cardiac depression side-effects were weaker cf nifedipine."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to extract 1995 from the string to precdate2. I tried the following code. But I am not any values in the output field precdate2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;prx = prxparse("/(\s)(\d\d\d\d)(\s)/");&lt;BR /&gt; if prxmatch(prx, Preclinical) then do;&lt;BR /&gt; precdate2 = prxposn(prx, 4, Preclinical);&lt;BR /&gt; end;&lt;/P&gt;</description>
      <pubDate>Sat, 20 May 2017 21:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360224#M274638</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2017-05-20T21:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract specific 4 digits from large string where the location varies</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360232#M274639</link>
      <description>&lt;PRE&gt;data want;
  set have;
  prx = prxparse("/(\d\d\d\d)/");
  if prxmatch(prx, Preclinical) then do;
    precdate2 = prxposn(prx,1, Preclinical);
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 May 2017 21:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360232#M274639</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-20T21:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract specific 4 digits from large string where the location varies</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360256#M274640</link>
      <description>&lt;P&gt;And to only allow the centuries 19 and 20 at the beginning of the four digit pattern:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  prx = prxparse("/\b((19|20)\d\d)\b/");
  if prxmatch(prx, Preclinical) then do;
    precdate2 = prxposn(prx,1, Preclinical);
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;\b is used to mark a boundary so that you don't pick up 4 digits out of a string of five digits but that a 4 digit string can also be followed not only by a blank but by something like a closing bracket or a point.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 May 2017 01:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360256#M274640</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-21T01:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract specific 4 digits from large string where the location varies</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360341#M274641</link>
      <description>&lt;P&gt;Or to do it differently:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if prxmatch("/\b(19|20)\d\d\b/o",PRECLINICAL) then
  PRECDATE2 = prxchange("s/.*\b((19|20)\d\d)\b.*/$1/o",1,PRECLINICAL);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 May 2017 23:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360341#M274641</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-05-21T23:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract specific 4 digits from large string where the location varies</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360468#M274642</link>
      <description>&lt;P&gt;This also looks intersting. Thanks !!&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 15:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-specific-4-digits-from-large-string-where-the/m-p/360468#M274642</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2017-05-22T15:22:10Z</dc:date>
    </item>
  </channel>
</rss>

