<?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: Delete text between brackets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53632#M11331</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote a code before, to pull over string from the source code of html just like your situation.&lt;/P&gt;&lt;P&gt;But I do not know whether the code is suited for your situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data want(where=(row not in (' ' '&amp;amp;NBSP;')));
 infile datalines dsd&amp;nbsp; dlm='&amp;gt;&amp;lt;' ;
 format row $200.;
 input @'&amp;gt;' row&amp;nbsp; @@;
datalines4;
&lt;P style="margin: 0IN 0IN 0PT;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;amp;NBSP;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0IN 0IN 0PT;"&gt;&lt;STRONG style="font-size: 10pt;"&gt;DERIVATIVES AND HEDGING ACTIVITY: 
&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;THE COMPANY USES COMMODITY AND CURRENCY POSITIONS TO MANAGE ITS EXPOSURE TO PRICE FLUCTUATIONS IN THOSE MARKETS
;;;;
run;
&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Ksharp&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Aug 2011 06:02:39 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-08-25T06:02:39Z</dc:date>
    <item>
      <title>Delete text between brackets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53628#M11327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following problem. I have a string variable which contains to some extent text strings that are surrounded by brackets. E.g.: &lt;/P&gt;&lt;P&gt;&amp;lt;P STYLE="MARGIN: 0IN 0IN 0PT"&amp;gt;&amp;lt;FONT STYLE="FONT-SIZE: 10PT; FONT-FAMILY: TIMES NEW ROMAN" SIZE="2"&amp;gt;&amp;amp;NBSP;&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt; &amp;lt;P STYLE="MARGIN: 0IN 0IN 0PT"&amp;gt;&amp;lt;B&amp;gt;&amp;lt;FONT STYLE="FONT-WEIGHT: BOLD; FONT-SIZE: 10PT; FONT-FAMILY: TIMES NEW ROMAN" SIZE="2"&amp;gt;DERIVATIVES AND HEDGING ACTIVITY: &amp;lt;/FONT&amp;gt;&amp;lt;/B&amp;gt;&amp;lt;FONT STYLE="FONT-SIZE: 10PT" SIZE="2"&amp;gt;THE COMPANY USES COMMODITY AND CURRENCY POSITIONS TO MANAGE ITS EXPOSURE TO PRICE FLUCTUATIONS IN THOSE MARKETS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to keep only the text strings that are not surrounded by brackets, here this would be: DERIVATIVES AND HEDGING ACTIVITY: THE COMPANY USES COMMODITY AND CURRENCY POSITIONS TO MANAGE ITS EXPOSURE TO PRICE FLUCTUATIONS IN THOSE MARKETS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can this be executed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 08:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53628#M11327</guid>
      <dc:creator>Valentin_HU</dc:creator>
      <dc:date>2011-08-24T08:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete text between brackets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53629#M11328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use a regular expression. Note there is one other text string that is not enclosed in &amp;lt;&amp;gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; FT15F001 &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;temp&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;lrecl&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;512&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; FT15F001;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; _n_ eq &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; rx = prxparse(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'s/&amp;lt;[^&amp;gt;]*&amp;gt;//'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; rx;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; c $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;512&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; c = prxchange(rx,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;,_infile_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;putlog&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; c=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;parmcards4&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;&amp;lt;P STYLE="MARGIN: 0IN 0IN 0PT"&amp;gt;&amp;lt;FONT STYLE="FONT-SIZE: 10PT; FONT-FAMILY: TIMES NEW ROMAN" SIZE="2"&amp;gt;&amp;amp;NBSP;&amp;lt;/FONT&amp;gt;&amp;lt;/P&amp;gt; &amp;lt;P STYLE="MARGIN: 0IN 0IN 0PT"&amp;gt;&amp;lt;B&amp;gt;&amp;lt;FONT STYLE="FONT-WEIGHT: BOLD; FONT-SIZE: 10PT; FONT-FAMILY: TIMES NEW ROMAN" SIZE="2"&amp;gt;DERIVATIVES AND HEDGING ACTIVITY: &amp;lt;/FONT&amp;gt;&amp;lt;/B&amp;gt;&amp;lt;FONT STYLE="FONT-SIZE: 10PT" SIZE="2"&amp;gt;THE COMPANY USES COMMODITY AND CURRENCY POSITIONS TO MANAGE ITS EXPOSURE TO PRICE FLUCTUATIONS IN THOSE MARKETS&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 11:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53629#M11328</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-08-24T11:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Delete text between brackets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53630#M11329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Just to add to data_null_'s answer,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;1) s/&amp;lt;[^&amp;gt;]*&amp;gt;// can also be expressed as s/&amp;lt;.*?&amp;gt;//&amp;nbsp;&amp;nbsp; these &lt;/SPAN&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;two expressions are identical.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;The "*?" is the lazy repetition operator that stops as soon as possible, whereas the normal "*" repetition operator is greedy and will match as much as possible.&amp;nbsp; Difference only show up when there are unbalanced delimiters, e.g., &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;lt;aaa&amp;gt;bbb&amp;gt;&amp;nbsp;&amp;nbsp; s/&amp;lt;.*&amp;gt;// would eliminate the whole string, s/&amp;lt;.*?&amp;gt;// would eliminate up to the first '&amp;gt;' only and leave bbb&amp;gt; untouched.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;2) prxchange( rx, -1, string )&amp;nbsp;&amp;nbsp;&amp;nbsp; the "-1" would perform rx until the end of string, however many times that happens to be.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 15:51:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53630#M11329</guid>
      <dc:creator>DLing</dc:creator>
      <dc:date>2011-08-24T15:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Delete text between brackets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53631#M11330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The remaining string I believe is the "&amp;amp;NBSP" which is a non-collapsing space tag.&amp;nbsp; You could modify the regular expression to remove this additional tag as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s/&amp;lt;[^&amp;gt;]+&amp;gt;|\x26[^&amp;lt;&amp;gt;]*;//&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 16:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53631#M11330</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-08-24T16:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Delete text between brackets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53632#M11331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote a code before, to pull over string from the source code of html just like your situation.&lt;/P&gt;&lt;P&gt;But I do not know whether the code is suited for your situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data want(where=(row not in (' ' '&amp;amp;NBSP;')));
 infile datalines dsd&amp;nbsp; dlm='&amp;gt;&amp;lt;' ;
 format row $200.;
 input @'&amp;gt;' row&amp;nbsp; @@;
datalines4;
&lt;P style="margin: 0IN 0IN 0PT;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;amp;NBSP;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0IN 0IN 0PT;"&gt;&lt;STRONG style="font-size: 10pt;"&gt;DERIVATIVES AND HEDGING ACTIVITY: 
&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;THE COMPANY USES COMMODITY AND CURRENCY POSITIONS TO MANAGE ITS EXPOSURE TO PRICE FLUCTUATIONS IN THOSE MARKETS
;;;;
run;
&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Ksharp&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 06:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-text-between-brackets/m-p/53632#M11331</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-08-25T06:02:39Z</dc:date>
    </item>
  </channel>
</rss>

