<?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: replacing text in a data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/replacing-text-in-a-data-set/m-p/722380#M223979</link>
    <description>Thanks very much. This one worked.&lt;BR /&gt;if index(group,'Urban') then group = "Urban-Rural Residence";&lt;BR /&gt;</description>
    <pubDate>Sun, 28 Feb 2021 02:17:11 GMT</pubDate>
    <dc:creator>geneshackman</dc:creator>
    <dc:date>2021-02-28T02:17:11Z</dc:date>
    <item>
      <title>replacing text in a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replacing-text-in-a-data-set/m-p/722373#M223975</link>
      <description>&lt;P&gt;I have a data set that has a variable, "Group". Some cases have the value "Urban-Rural Residence". Some other cases have a value that is almost the same, but for some reason not exactly the same, although I don't see how. Excel thinks the other value is exactly the same.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I doubt it would be worth it to post or send a data set, because I'm not sure if any data set i post or send would actually have the difference in values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, I would like have code that says the following, and my question is how to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the value includes the string "Urban" then Group =&amp;nbsp;"Urban-Rural Residence";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thus, i would find some part of the value that hopefully is identical in all versions of the value, and just manually make them all have the same value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There seem to be a bunch of sas functions that might do this, but I don't quite get the difference in them all, even though I've searched a bit and read a bunch of stuff. What's the difference between contain, find, findw, index? Or would I use some other function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Gene&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Feb 2021 23:44:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replacing-text-in-a-data-set/m-p/722373#M223975</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-02-27T23:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: replacing text in a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replacing-text-in-a-data-set/m-p/722378#M223977</link>
      <description>&lt;P&gt;Try:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;group = compress(group,,'kA');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if index(group,'Urban') then group = "Urban-Rural Residence";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 01:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replacing-text-in-a-data-set/m-p/722378#M223977</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-28T01:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: replacing text in a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replacing-text-in-a-data-set/m-p/722380#M223979</link>
      <description>Thanks very much. This one worked.&lt;BR /&gt;if index(group,'Urban') then group = "Urban-Rural Residence";&lt;BR /&gt;</description>
      <pubDate>Sun, 28 Feb 2021 02:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replacing-text-in-a-data-set/m-p/722380#M223979</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2021-02-28T02:17:11Z</dc:date>
    </item>
  </channel>
</rss>

