<?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 Delete parts of variables, but how?? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32535#M7836</link>
    <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I've got a dataset in which I want to remain everything after a particular word, like "debtor". Like:&lt;BR /&gt;
&lt;BR /&gt;
ID | Variable_1&lt;BR /&gt;
1    xxx debtor profile 7&lt;BR /&gt;
2    x debtor profile 3 to 1&lt;BR /&gt;
3    xx debtor profiles 133 to 155&lt;BR /&gt;
4    xxxx debtor profile 3&lt;BR /&gt;
&lt;BR /&gt;
So the final result would be:&lt;BR /&gt;
&lt;BR /&gt;
ID | Variable_1&lt;BR /&gt;
1    profile 7&lt;BR /&gt;
2    profile 3 to 1&lt;BR /&gt;
3    profiles 133 to 155&lt;BR /&gt;
4    profile 3&lt;BR /&gt;
&lt;BR /&gt;
In other words, I need a statement with which I could delete everything to the left of a particular word. Anyone any idea? Thanks in advance!</description>
    <pubDate>Fri, 18 Jul 2008 23:32:52 GMT</pubDate>
    <dc:creator>Wouter</dc:creator>
    <dc:date>2008-07-18T23:32:52Z</dc:date>
    <item>
      <title>Delete parts of variables, but how??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32535#M7836</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I've got a dataset in which I want to remain everything after a particular word, like "debtor". Like:&lt;BR /&gt;
&lt;BR /&gt;
ID | Variable_1&lt;BR /&gt;
1    xxx debtor profile 7&lt;BR /&gt;
2    x debtor profile 3 to 1&lt;BR /&gt;
3    xx debtor profiles 133 to 155&lt;BR /&gt;
4    xxxx debtor profile 3&lt;BR /&gt;
&lt;BR /&gt;
So the final result would be:&lt;BR /&gt;
&lt;BR /&gt;
ID | Variable_1&lt;BR /&gt;
1    profile 7&lt;BR /&gt;
2    profile 3 to 1&lt;BR /&gt;
3    profiles 133 to 155&lt;BR /&gt;
4    profile 3&lt;BR /&gt;
&lt;BR /&gt;
In other words, I need a statement with which I could delete everything to the left of a particular word. Anyone any idea? Thanks in advance!</description>
      <pubDate>Fri, 18 Jul 2008 23:32:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32535#M7836</guid>
      <dc:creator>Wouter</dc:creator>
      <dc:date>2008-07-18T23:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Delete parts of variables, but how??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32536#M7837</link>
      <description>Hi.&lt;BR /&gt;
What you can try is check where "debtor" is with the INDEW function, then pick the string beginning after that place with a SUBSTR function.&lt;BR /&gt;
[pre]&lt;BR /&gt;
DATA test ;&lt;BR /&gt;
	INFILE CARDS MISSOVER DLM="," ;&lt;BR /&gt;
	INPUT Variable_1 :$50. ;&lt;BR /&gt;
	posDebtor = INDEXW(variable_1, "debtor") ;&lt;BR /&gt;
	afterDebtor = LEFT(SUBSTR(variable_1, posDebtor+LENGTH("debtor"))) ;&lt;BR /&gt;
CARDS ;&lt;BR /&gt;
xxx debtor profile 7&lt;BR /&gt;
x debtor profile 3 to 1&lt;BR /&gt;
xx x x x x xx debtor profiles 133 to 155&lt;BR /&gt;
xxxx debtor profile 3&lt;BR /&gt;
;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Regards.&lt;BR /&gt;
Olivier</description>
      <pubDate>Sat, 19 Jul 2008 07:48:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32536#M7837</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2008-07-19T07:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Delete parts of variables, but how??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32537#M7838</link>
      <description>Thanks, works perfect!! Right now, I don't fully understand the complete code (the statements INDEXW, SUBSTR), but the idea I fully understand. Most of the time, I've got the idea, but lacking the ability to 'convert' it into SAS codes... Right now, I'm going to check the statements. Thanks!!</description>
      <pubDate>Sat, 19 Jul 2008 12:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32537#M7838</guid>
      <dc:creator>Wouter</dc:creator>
      <dc:date>2008-07-19T12:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete parts of variables, but how??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32538#M7839</link>
      <description>Consider using the SCAN function in a DATA step to extract / parse your SAS variable.  Your delimiter argument can be a something other than a single character, which will work for your circumstances.&lt;BR /&gt;
&lt;BR /&gt;
Related topic links are provided for your reference - found on the SAS support website. &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; &lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SUGI 2007 paper:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2007/035-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/035-2007.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
SAS DOC on SCAN function:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000214639.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000214639.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
SAS Support SAMPLES:&lt;BR /&gt;
&lt;BR /&gt;
ftp://ftp.sas.com/techsup/download/sample/datastep/scanfunction.html</description>
      <pubDate>Sat, 19 Jul 2008 16:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Delete-parts-of-variables-but-how/m-p/32538#M7839</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-07-19T16:01:06Z</dc:date>
    </item>
  </channel>
</rss>

