<?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: Removing a certain part of a word in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187576#M304049</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ohhh amazin'! Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Feb 2014 12:17:21 GMT</pubDate>
    <dc:creator>Takumi</dc:creator>
    <dc:date>2014-02-26T12:17:21Z</dc:date>
    <item>
      <title>Removing a certain part of a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187573#M304046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Print: Data Set WORK.UT"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;obs&lt;/TH&gt;&lt;TD class="l data"&gt;PARK&lt;/TD&gt;&lt;TD class="l data"&gt;ST&lt;/TD&gt;&lt;TD class="r data"&gt;YRESTAB&lt;/TD&gt;&lt;TD class="r data"&gt;ACRES&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;&lt;TD class="l data"&gt;Arches&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1971&lt;/TD&gt;&lt;TD class="r data"&gt;73000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;&lt;TD class="l data"&gt;Canyonlands&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1964&lt;/TD&gt;&lt;TD class="r data"&gt;338000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;&lt;TD class="l data"&gt;Capitol Reef&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1971&lt;/TD&gt;&lt;TD class="r data"&gt;242000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;&lt;TD class="l data"&gt;Zion&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1919&lt;/TD&gt;&lt;TD class="r data"&gt;147000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;&lt;TD class="l data"&gt;Bryce Canyon&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1924&lt;/TD&gt;&lt;TD class="r data"&gt;36000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello. I was told to remove the word "Canyon" in "PARK".&lt;/P&gt;&lt;P&gt;So this is what I did:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG style=": ; font-size: 10pt;"&gt;DATA UT;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;Infile &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt;"&gt;'C:\SAS\natlpark.txt'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;PARK $ &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;- &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;20&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; ST $ &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;21&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;22&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; YRESTAB &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;25&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;28&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; ACRES &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;COMMA10.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;If st ^= &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt;"&gt;"UT"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;delete&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG style=": ; font-size: 10pt;"&gt;Acres = round(acres,1000);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG style=": ; font-size: 10pt;"&gt;t = indexw(park, 'Canyon')';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;If &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;t &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; PARK = substr(park,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,t-&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG style=": ; font-size: 10pt;"&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial black,avant garde;"&gt;&lt;STRONG style=": ; font-size: 10pt;"&gt;proc print data=UT;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Print: Data Set WORK.UT"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;obs&lt;/TH&gt;&lt;TD class="l data"&gt;PARK&lt;/TD&gt;&lt;TD class="l data"&gt;ST&lt;/TD&gt;&lt;TD class="r data"&gt;YRESTAB&lt;/TD&gt;&lt;TD class="r data"&gt;ACRES&lt;/TD&gt;&lt;TD class="r data"&gt;t&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;&lt;TD class="l data"&gt;Arches&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1971&lt;/TD&gt;&lt;TD class="r data"&gt;73000&lt;/TD&gt;&lt;TD class="r data"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;&lt;TD class="l data"&gt;Canyonlands&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1964&lt;/TD&gt;&lt;TD class="r data"&gt;338000&lt;/TD&gt;&lt;TD class="r data"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;&lt;TD class="l data"&gt;Capitol Reef&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1971&lt;/TD&gt;&lt;TD class="r data"&gt;242000&lt;/TD&gt;&lt;TD class="r data"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;&lt;TD class="l data"&gt;Zion&lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1919&lt;/TD&gt;&lt;TD class="r data"&gt;147000&lt;/TD&gt;&lt;TD class="r data"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;&lt;TD class="l data"&gt;Bryce &lt;/TD&gt;&lt;TD class="l data"&gt;UT&lt;/TD&gt;&lt;TD class="r data"&gt;1924&lt;/TD&gt;&lt;TD class="r data"&gt;36000&lt;/TD&gt;&lt;TD class="r data"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;As you can see I successfully removed the word Canyon from "Bryce Canyon", but from observation 2 the word "Canyonlands" still carries with it the word "Canyon" at the front. I tried using the split(), scan(), but it gives me weird answers. How can I remove the word Canyon in Canyonlands??&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 11:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187573#M304046</guid>
      <dc:creator>Takumi</dc:creator>
      <dc:date>2014-02-26T11:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a certain part of a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187574#M304047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;indexW searches for words perhaps you want to seach at the string level.&amp;nbsp; Look for a function that searches in that way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 11:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187574#M304047</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-02-26T11:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a certain part of a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187575#M304048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tranwrd would be one option:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEW_PARK = tranwrd(upcase(PARK),"CANYON",""));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 11:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187575#M304048</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-02-26T11:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a certain part of a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187576#M304049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ohhh amazin'! Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 12:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187576#M304049</guid>
      <dc:creator>Takumi</dc:creator>
      <dc:date>2014-02-26T12:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a certain part of a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187577#M304050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or u may try this&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;park=transtrn(park,&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;'Canyon'&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 12:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187577#M304050</guid>
      <dc:creator>pradeepalankar</dc:creator>
      <dc:date>2014-02-26T12:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Removing a certain part of a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187578#M304051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a complex method&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; background-color: white; color: black;"&gt;park=prxchange('s/(&lt;SPAN style="color: #800080; font-family: Consolas; background-color: #ffffff;"&gt;Canyon&lt;/SPAN&gt;)//i',-1,park&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; background-color: white; color: black;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 13:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-a-certain-part-of-a-word/m-p/187578#M304051</guid>
      <dc:creator>Xianhua_zeng</dc:creator>
      <dc:date>2014-02-26T13:34:19Z</dc:date>
    </item>
  </channel>
</rss>

