<?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: recoding variable that has different values but they are all the same in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262166#M51117</link>
    <description>&lt;P&gt;Instead of contains use FIND() or INDEX()&lt;/P&gt;
&lt;P&gt;Instead of like you can use : to do match from the start, but I would recommend perhaps, compged or some of those similarity functions.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2016 18:48:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-04-07T18:48:39Z</dc:date>
    <item>
      <title>recoding variable that has different values but they are all the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262162#M51115</link>
      <description>&lt;P&gt;my variable has different values, like:&lt;/P&gt;
&lt;P&gt;ach&lt;/P&gt;
&lt;P&gt;ach (optioinal)&lt;/P&gt;
&lt;P&gt;bank transfer (ach)&lt;/P&gt;
&lt;P&gt;bank_transfer&lt;/P&gt;
&lt;P&gt;online banking transf&lt;/P&gt;
&lt;P&gt;onlinebanking&lt;/P&gt;
&lt;P&gt;online transfer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They all mean the same thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to use if ... then ... to recode them, can I use "contain" or "like" or "in" operators in the if statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 18:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262162#M51115</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-07T18:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: recoding variable that has different values but they are all the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262165#M51116</link>
      <description>&lt;P&gt;The IN operator can be used in IF statements, but CONTAIN&lt;STRONG&gt;S&lt;/STRONG&gt; and LIKE cannot. Use character &lt;EM&gt;functions&lt;/EM&gt;&amp;nbsp;instead.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 18:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262165#M51116</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-07T18:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: recoding variable that has different values but they are all the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262166#M51117</link>
      <description>&lt;P&gt;Instead of contains use FIND() or INDEX()&lt;/P&gt;
&lt;P&gt;Instead of like you can use : to do match from the start, but I would recommend perhaps, compged or some of those similarity functions.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 18:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262166#M51117</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-07T18:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: recoding variable that has different values but they are all the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262176#M51126</link>
      <description>&lt;P&gt;You should consider creating a permanent format (or a permanent informat as an alternative).&amp;nbsp; Here's what a temporary format might look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;/P&gt;
&lt;P&gt;value $ach&lt;/P&gt;
&lt;P&gt;'ach',&lt;/P&gt;
&lt;P&gt;'ach (optioinal)',&lt;/P&gt;
&lt;P&gt;'bank transfer (ach)',&lt;/P&gt;
&lt;P&gt;'bank_transfer',&lt;/P&gt;
&lt;P&gt;'online banking transf',&lt;/P&gt;
&lt;P&gt;'onlinebanking',&lt;/P&gt;
&lt;P&gt;'online transfer'&lt;/P&gt;
&lt;P&gt;= 'ach';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then when you want to check against the list, you can use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if&amp;nbsp; /* or WHERE, either will work */&amp;nbsp; put(var, $ach.) = 'ach';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The advantage here is that you only need to store a format once.&amp;nbsp; But you can then use the IF or WHERE statement in many programs.&amp;nbsp; If you ever need to add to the list, you don't have to change all the programs.&amp;nbsp; Update the permanently saved format and all the programs that refer to it are automatically updated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that saving a format permanently and reusing it later is not an introductory topic.&amp;nbsp; It's not terribly long or complex, but it's not introductory.&amp;nbsp; So choose the right time to learn how to do those things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 20:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262176#M51126</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-07T20:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: recoding variable that has different values but they are all the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262462#M51242</link>
      <description>&lt;P&gt;thank you very much. Would you mind telling me how to save the format permenantly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do have this problem, that when I tried to open a data set for which I used a self defined format, SAS complains about the format and I have to find the code containing the format and run the format again, to open the data file.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 14:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262462#M51242</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-08T14:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: recoding variable that has different values but they are all the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262529#M51277</link>
      <description>&lt;P&gt;To save a format permanently, you need to add the LIBRARY= option to the PROC FORMAT statement. &amp;nbsp;To retrieve permanently saved formats, you need to add the FMTSEARCH global option to your program. &amp;nbsp;You can look those up in the documentation, or you can find some decent examples in this paper:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/library/formats.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/library/formats.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262529#M51277</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-08T16:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: recoding variable that has different values but they are all the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262546#M51282</link>
      <description>&lt;P&gt;great! thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 17:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/recoding-variable-that-has-different-values-but-they-are-all-the/m-p/262546#M51282</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-08T17:49:50Z</dc:date>
    </item>
  </channel>
</rss>

