<?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 use Regular expression read strings on multiple lines in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210735#M39050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe this is what you are looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;a="103 Pennsylvania Ave. NW,";output;&lt;BR /&gt;a="Washington, DC 20216" ;output;&lt;BR /&gt;a="NY, DC 20216" ;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;data b;&lt;BR /&gt;set a;&lt;BR /&gt;b=prxparse("/103 Pennsylvania Ave\. NW|Washington, DC 20216/");&lt;BR /&gt;e= prxmatch(b,a);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check also the following link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002295977.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002295977.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2015 12:16:52 GMT</pubDate>
    <dc:creator>Loko</dc:creator>
    <dc:date>2015-05-07T12:16:52Z</dc:date>
    <item>
      <title>how to use Regular expression read strings on multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210733#M39048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;Can someone tell me why the metacharacter \n is not working for the program belw&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data a;&lt;BR /&gt;infile cards truncover;&lt;BR /&gt;length a $1;&lt;BR /&gt;input a $150.;&lt;BR /&gt;cards;&lt;BR /&gt;a&lt;BR /&gt;b&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;set a;&lt;/P&gt;&lt;P&gt;e=prxmatch("/a\nb",a);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 04:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210733#M39048</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2015-05-07T04:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to use Regular expression read strings on multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210734#M39049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have two obs not one , therefore PRX can't work on that situation .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 12:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210734#M39049</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-07T12:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to use Regular expression read strings on multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210735#M39050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe this is what you are looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;a="103 Pennsylvania Ave. NW,";output;&lt;BR /&gt;a="Washington, DC 20216" ;output;&lt;BR /&gt;a="NY, DC 20216" ;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;data b;&lt;BR /&gt;set a;&lt;BR /&gt;b=prxparse("/103 Pennsylvania Ave\. NW|Washington, DC 20216/");&lt;BR /&gt;e= prxmatch(b,a);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check also the following link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002295977.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002295977.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 12:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210735#M39050</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2015-05-07T12:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to use Regular expression read strings on multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210736#M39051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI ksharp,&lt;/P&gt;&lt;P&gt;can an you use \n to read new line in regular expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 20:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210736#M39051</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2015-05-07T20:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to use Regular expression read strings on multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210737#M39052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have modified the program to make it more simple.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 01:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210737#M39052</guid>
      <dc:creator>gyambqt</dc:creator>
      <dc:date>2015-05-08T01:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to use Regular expression read strings on multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210738#M39053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No.&lt;/P&gt;&lt;P&gt;If you have organized your dataset so that each line is on a separate observation you cannot use the SAS perl regular expression functions to operate across observations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To check if you ever have the condition that "B" follows "A" in your data set perhaps you want to use LAG() function?&lt;/P&gt;&lt;P&gt;Here is a trivial example .&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input a $ ;&lt;/P&gt;&lt;P&gt; if a='B' and lag(a)='A' then found=1;&lt;/P&gt;&lt;P&gt;else found=0;&lt;/P&gt;&lt;P&gt;CARDS;&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case only the second and the final observation will have FOUND set to 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 03:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210738#M39053</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-05-08T03:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to use Regular expression read strings on multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210739#M39054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would not use SAS for this type of parsing of a structured text file. Use &lt;A href="http://en.wikipedia.org/wiki/Awk"&gt;awk&lt;/A&gt;: it is designed for this. Awk is a small program available on almost all operating systems. It is part of unix. If you do not have awk, use perl, which is bigger and more complex. After you have used awk to reorganise the data, read it into SAS. You should be able to run the awk from SAS, or use a command script to run both. I use this method frequently.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2015 10:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-Regular-expression-read-strings-on-multiple-lines/m-p/210739#M39054</guid>
      <dc:creator>Peter_L</dc:creator>
      <dc:date>2015-05-12T10:48:01Z</dc:date>
    </item>
  </channel>
</rss>

