<?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: Keep string after a symbol in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522689#M141946</link>
    <description>1. calc the position of â€“ in the string.&lt;BR /&gt;2. substr everything from after that position to the end of the string.</description>
    <pubDate>Wed, 19 Dec 2018 20:43:13 GMT</pubDate>
    <dc:creator>tomrvincent</dc:creator>
    <dc:date>2018-12-19T20:43:13Z</dc:date>
    <item>
      <title>Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522686#M141944</link>
      <description>&lt;P&gt;Hello, I need to create a new variable based on an existing one that contains a value such as: &lt;STRONG&gt;"SV01 â€“ Study visit out of window"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to keep everything after the&amp;nbsp;&lt;SPAN&gt;â€“ and remove the leading space so that the new variable contains &lt;STRONG&gt;"Study visit out of window"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the lengths of the input variable are not the same.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 20:37:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522686#M141944</guid>
      <dc:creator>mglogan</dc:creator>
      <dc:date>2018-12-19T20:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522689#M141946</link>
      <description>1. calc the position of â€“ in the string.&lt;BR /&gt;2. substr everything from after that position to the end of the string.</description>
      <pubDate>Wed, 19 Dec 2018 20:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522689#M141946</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2018-12-19T20:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522690#M141947</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
have="SV01 â€“ Study visit out of window";
want=substr(have,find(have,"â€“")+4);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
have="SV01 â€“ Study visit out of window";
want=strip(scan(have,-1,"â€“"));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 20:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522690#M141947</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-19T20:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522694#M141948</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	var1="SV01 â€“ Study visit out of window"; output;
	var1="â€“ SV01 Study visit out of window"; output;
	var1=" SV01  Study visit out of â€“ window"; output;

run;

data want;
Length var1 var2 $100.;
	set have;
	var2=strip(substr(strip(var1),findw(var1,"â€“")+3));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Dec 2018 20:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522694#M141948</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-19T20:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522696#M141950</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 20:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522696#M141950</guid>
      <dc:creator>mglogan</dc:creator>
      <dc:date>2018-12-19T20:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522697#M141951</link>
      <description>&lt;P&gt;Kindly test thoroughly and come back to us if you jump into some intricacies. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 20:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522697#M141951</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-19T20:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522700#M141952</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp; way is cleaner and simpler and this is just another way using prxchange. brief explanation of prxchange below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;^(.+?)? this is first and starting&amp;nbsp;position and indicate that this position could be there or not&lt;/P&gt;
&lt;P&gt;(â€“) -- this is second&amp;nbsp;patter &amp;nbsp;and has the symbol thing&lt;/P&gt;
&lt;P&gt;(.+)$&amp;nbsp; -- this is third position after second position till the end&lt;/P&gt;
&lt;P&gt;/$3/ -- this means replace everything with third position/pattern&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;PRE&gt;data test;&lt;BR /&gt;have="SV01 â€“ Study visit out of window";&lt;BR /&gt;want=prxchange('s/^(.+?)?(â€“)(.+)$/$3/', 1, have);&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 21:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522700#M141952</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-12-19T21:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522703#M141953</link>
      <description>&lt;P&gt;Because SCAN uses any of the single characters in the third parameter position it may not be the best&amp;nbsp;solution if either the â€ or " might appear anyplace other than as a pair. Example:&lt;/P&gt;
&lt;PRE&gt;data test;
have="SV01 â€“ Study visit out “of window";
want=strip(scan(have,-1,"â€“"));
run;&lt;/PRE&gt;
&lt;P&gt;Which returns "of window" as the value for want since the Scan function is using a single delimiting character and reading from right to left (the -1 parameter) to get the end of the string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 21:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522703#M141953</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-19T21:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522710#M141955</link>
      <description>&lt;P&gt;This should address that problem, perhaps?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Convert the&amp;nbsp;â€“ to tab delim and the same approach&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
have="SV01 â€“ Study visit out “of window";
temp=tranwrd(have,'â€“','09'x);
want=strip(scan(temp,-1,'09'x));
drop temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Dec 2018 21:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522710#M141955</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-19T21:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Keep string after a symbol in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522754#M141974</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This should address that problem, perhaps?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Convert the&amp;nbsp;â€“ to tab delim and the same approach&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
have="SV01 â€“ Study visit out “of window";
temp=tranwrd(have,'â€“','09'x);
want=strip(scan(temp,-1,'09'x));
drop temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, something like that or other approaches. I mentioned the issue so if the OP had run the code with SCAN and got unexpected results there would be a place to look for the cause. I will &lt;STRONG&gt;not&lt;/STRONG&gt; mention how much time I spend running down&amp;nbsp;similar data issues when provided data that some value "always" occurs with another specific value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 23:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-string-after-a-symbol-in-SAS/m-p/522754#M141974</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-19T23:51:28Z</dc:date>
    </item>
  </channel>
</rss>

