<?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 can i remove first letters starting after &amp;quot;-&amp;quot; anad replace it with another variabl in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644803#M192662</link>
    <description>&lt;P&gt;If there is only one '-' in var1 you can use next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;langth var3 $30; /* adapt to max length expected */
var3 = cats(var2, scan(var1,2,'-'));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 03 May 2020 08:42:55 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2020-05-03T08:42:55Z</dc:date>
    <item>
      <title>how can i remove first letters starting after "-" anad replace it with another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644799#M192659</link>
      <description>&lt;P&gt;I have an issue where a variable has&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var1&lt;/P&gt;
&lt;P&gt;1-Text out of range&lt;/P&gt;
&lt;P&gt;11-minimum-score of text&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var2&lt;/P&gt;
&lt;P&gt;MES1102&lt;/P&gt;
&lt;P&gt;MES1129&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to replace after "-" from var1 and get text in var2 in that place. something like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var3&lt;/P&gt;
&lt;P&gt;MES1102-Text out of range&lt;/P&gt;
&lt;P&gt;MES1129-minimum-score of text&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any help on how to do it in datastep&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2020 08:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644799#M192659</guid>
      <dc:creator>noda6003</dc:creator>
      <dc:date>2020-05-03T08:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: how can i remove first letters starting after "-" anad replace it with another variabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644802#M192661</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240711"&gt;@noda6003&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one approach to achieve this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm=",";
	input var1:$50. var2:$50.;
	datalines;
1-Text out of range,MES1102
11-minimum-score of text,MES1129
	;
run;

data want;
	set have;
	length var3 $ 50;
	var3 = tranwrd(strip(var1),scan(var1,1,"-"),strip(var2));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture d’écran 2020-05-03 à 10.38.50.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39007i2294C8D677059B47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-05-03 à 10.38.50.png" alt="Capture d’écran 2020-05-03 à 10.38.50.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2020 08:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644802#M192661</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-03T08:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: how can i remove first letters starting after "-" anad replace it with another variabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644803#M192662</link>
      <description>&lt;P&gt;If there is only one '-' in var1 you can use next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;langth var3 $30; /* adapt to max length expected */
var3 = cats(var2, scan(var1,2,'-'));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 May 2020 08:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644803#M192662</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-05-03T08:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: how can i remove first letters starting after "-" anad replace it with another variabl</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644804#M192663</link>
      <description>&lt;P&gt;Another possibility could be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	length var3 $ 50;
	var3 = catx("-",var2,prxchange('s/\d+-(.*)/$1/',1,var1));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;-&amp;gt; it concatenates var2 and the second part of var1 with the delimiter "-"&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2020 08:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-i-remove-first-letters-starting-after-quot-quot-anad/m-p/644804#M192663</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-03T08:43:13Z</dc:date>
    </item>
  </channel>
</rss>

