<?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 strip characters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616891#M180690</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296078"&gt;@Solly7&lt;/a&gt;&amp;nbsp; &amp;nbsp;If length of Var2 is going to be 8, all you need is define a compile time LENGTH statement and not bother with anything else .&lt;/P&gt;
&lt;P&gt;For Example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Data have ;
	input var1 $30.;
	datalines;
matomese@rrrtrtr
lucozade1rtrrrere
sollyseb+rytryr
;
run;

data want;
 set have;
 length 	var2 $8;
 var2=var1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jan 2020 12:41:38 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-01-13T12:41:38Z</dc:date>
    <item>
      <title>how to strip characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616847#M180666</link>
      <description>&lt;P&gt;Hi, i need help in removing characters from ninth value and remain with the first 8 characters. See below dummy data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;&amp;nbsp; &amp;nbsp;work.names&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Data have&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Data Want&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;matomese@rrrtrtr&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;matomese&lt;/P&gt;&lt;P&gt;lucozade1rtrrrere&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lucozade&lt;/P&gt;&lt;P&gt;sollyseb+rytryr&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sollyseb&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 08:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616847#M180666</guid>
      <dc:creator>Solly7</dc:creator>
      <dc:date>2020-01-13T08:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to strip characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616851#M180668</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296078"&gt;@Solly7&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have ;
	input var1 $30.;
	datalines;
matomese@rrrtrtr
lucozade1rtrrrere
sollyseb+rytryr
;
run;

/* If the length of the word to extract is always 8 */
data want;
	set have;
	var2 = substr(var1,1,8);
run;

/* Otherwise you can search for the first word delimited by any character which is not in the alphabet */
data want;
	set have;
	var2 = scan(var1,1,"","ak");
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NB: information on modifiers for the SCAN() function (like "ak") is available on:&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=ds2ref&amp;amp;docsetTarget=p13adatt2vvhcxn1ext6w6eet24p.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n05sdv0n12bqn2n1973jozn2vzds" target="_self"&gt;https://documentation.sas.com/?docsetId=ds2ref&amp;amp;docsetTarget=p13adatt2vvhcxn1ext6w6eet24p.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n05sdv0n12bqn2n1973jozn2vzds&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 08:54:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616851#M180668</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-01-13T08:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to strip characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616873#M180684</link>
      <description>&lt;P&gt;thank you so much&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 11:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616873#M180684</guid>
      <dc:creator>Solly7</dc:creator>
      <dc:date>2020-01-13T11:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to strip characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616891#M180690</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296078"&gt;@Solly7&lt;/a&gt;&amp;nbsp; &amp;nbsp;If length of Var2 is going to be 8, all you need is define a compile time LENGTH statement and not bother with anything else .&lt;/P&gt;
&lt;P&gt;For Example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Data have ;
	input var1 $30.;
	datalines;
matomese@rrrtrtr
lucozade1rtrrrere
sollyseb+rytryr
;
run;

data want;
 set have;
 length 	var2 $8;
 var2=var1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 12:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-strip-characters/m-p/616891#M180690</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-13T12:41:38Z</dc:date>
    </item>
  </channel>
</rss>

