<?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: Get the character from mix of symbols using COMPRESS, INDEX, LEFT, TRIM? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608881#M76685</link>
    <description>&lt;P&gt;The example data you show for&lt;/P&gt;
&lt;PRE&gt;* '''[[Nick]]''' &lt;/PRE&gt;
&lt;P&gt;is 3 single quotes.&lt;/P&gt;
&lt;P&gt;which would work with&lt;/P&gt;
&lt;PRE&gt;data junk;
x="* '''[[Nick]]'''";
newX=compress(x ,";{|-*![=],'");
run;&lt;/PRE&gt;
&lt;P&gt;If you need to find one of the quote character you can double in the search string such as&lt;/P&gt;
&lt;PRE&gt;newX=compress(x ,";{|-*![=]"",'");
&lt;/PRE&gt;
&lt;P&gt;I placed the double quote to use in the search away from the quotes used to delimit the string so you can read it a bit more clearly. Note that in the editor a single " in the middle would show as an unbalance quote by having one or more characters appear differently than the quoted string. With the doubled character the entire string&amp;nbsp; appears and is treated as a single string.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Dec 2019 22:21:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-12-02T22:21:46Z</dc:date>
    <item>
      <title>Get the character from mix of symbols using COMPRESS, INDEX, LEFT, TRIM?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608877#M76683</link>
      <description>&lt;P&gt;I have a data set named names with only one variable x.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* '''[[Nick]]'''&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* [[KK Circle]]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* [[Spenser]]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;||-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* Cool&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;||&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to create a new dataset with two variables, the first being the whole old line, and the second variable with only the names.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And each like should be only the line with character in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like:&lt;/P&gt;&lt;P&gt;x &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;newX&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* '''[[Nick]]''' &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Nick&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* [[KK Circle]] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; KK Circle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* [[Spenser]] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Spenser&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* Cool &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Cool&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;newX=compress(x ,";{|-*![=],");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but I couldn't get rid of the "" on the line Nick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Might not need to use all of&amp;nbsp;COMPRESS, INDEX, LEFT, TRIM, but these might be useful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 22:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608877#M76683</guid>
      <dc:creator>dupp99</dc:creator>
      <dc:date>2019-12-02T22:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get the character from mix of symbols using COMPRESS, INDEX, LEFT, TRIM?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608881#M76685</link>
      <description>&lt;P&gt;The example data you show for&lt;/P&gt;
&lt;PRE&gt;* '''[[Nick]]''' &lt;/PRE&gt;
&lt;P&gt;is 3 single quotes.&lt;/P&gt;
&lt;P&gt;which would work with&lt;/P&gt;
&lt;PRE&gt;data junk;
x="* '''[[Nick]]'''";
newX=compress(x ,";{|-*![=],'");
run;&lt;/PRE&gt;
&lt;P&gt;If you need to find one of the quote character you can double in the search string such as&lt;/P&gt;
&lt;PRE&gt;newX=compress(x ,";{|-*![=]"",'");
&lt;/PRE&gt;
&lt;P&gt;I placed the double quote to use in the search away from the quotes used to delimit the string so you can read it a bit more clearly. Note that in the editor a single " in the middle would show as an unbalance quote by having one or more characters appear differently than the quoted string. With the doubled character the entire string&amp;nbsp; appears and is treated as a single string.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 22:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608881#M76685</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-02T22:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get the character from mix of symbols using COMPRESS, INDEX, LEFT, TRIM?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608882#M76686</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input  x &amp;amp; $20.;
cards;
* '''[[Nick]]'''
* [[KK Circle]]
* [[Spenser]]
||-
* Cool
||
Name
;

data want;
set have;
want=compress(x,' ','ka');
if want&amp;gt;' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Dec 2019 22:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608882#M76686</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-02T22:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get the character from mix of symbols using COMPRESS, INDEX, LEFT, TRIM?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608884#M76687</link>
      <description>&lt;P&gt;Use compress and tell it which class of characters to keep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
   input x $32.;
   xnew = compress(x,,'KADS');
   cards;
x
* '''[[Nick]]'''
* [[KK Circle]]
* [[Spenser]]
||-
* Cool
* Cool 9
||
Name
;;;;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Dec 2019 22:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Get-the-character-from-mix-of-symbols-using-COMPRESS-INDEX-LEFT/m-p/608884#M76687</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-12-02T22:26:17Z</dc:date>
    </item>
  </channel>
</rss>

