<?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: Having difficulty in merging categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Having-difficulty-in-merging-categories/m-p/865295#M341703</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/344049"&gt;@almatruk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to merge the "independent" and "something else" categories into one category. and when I used this code SAS exclude them from the analysis&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is the code that I use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"if (POLITIC in (2,4) ) then POLITIC = 'Independent and others';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions on how to merge those two categories into one?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If variable POLITIC in (2,4) it must be numeric, and you cannot then assign a character string to the variable POLITIC. SAS will not allow this. A better solution (assuming POLITIC is numeric) is the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value politicf 1='Martian' 2,4='Independent and others' 3='Vulcan' 5='Klingon';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then assign the format POLITICF to your variable in a procedure or in a data step&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format politic politicf.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2023 19:15:44 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-03-20T19:15:44Z</dc:date>
    <item>
      <title>Having difficulty in merging categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-difficulty-in-merging-categories/m-p/865293#M341702</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge the "independent" and "something else" categories into one category. and when I used this code SAS exclude them from the analysis&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the code that I use&amp;nbsp;&lt;/P&gt;&lt;P&gt;"if (POLITIC in (2,4) ) then POLITIC = 'Independent and others';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions on how to merge those two categories into one?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 19:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-difficulty-in-merging-categories/m-p/865293#M341702</guid>
      <dc:creator>almatruk</dc:creator>
      <dc:date>2023-03-20T19:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Having difficulty in merging categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-difficulty-in-merging-categories/m-p/865295#M341703</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/344049"&gt;@almatruk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to merge the "independent" and "something else" categories into one category. and when I used this code SAS exclude them from the analysis&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is the code that I use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"if (POLITIC in (2,4) ) then POLITIC = 'Independent and others';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions on how to merge those two categories into one?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If variable POLITIC in (2,4) it must be numeric, and you cannot then assign a character string to the variable POLITIC. SAS will not allow this. A better solution (assuming POLITIC is numeric) is the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value politicf 1='Martian' 2,4='Independent and others' 3='Vulcan' 5='Klingon';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then assign the format POLITICF to your variable in a procedure or in a data step&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format politic politicf.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 19:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-difficulty-in-merging-categories/m-p/865295#M341703</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-20T19:15:44Z</dc:date>
    </item>
  </channel>
</rss>

