<?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: Grouping non-mutually exclusive variables into categories in one variable in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853450#M42232</link>
    <description>&lt;P&gt;So, if for a given respondent, the value of&amp;nbsp;&lt;SPAN&gt;respondent_role___1 is equal to 1 and the value of&amp;nbsp;respondent_role___3 is equal to 1 and the value of&amp;nbsp;respondent_role___5 is equal to 1, what result do you want?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Would this work?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data= FSurvey1;
tables facility_desc: respondent_role: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 12 Jan 2023 14:30:15 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-01-12T14:30:15Z</dc:date>
    <item>
      <title>Grouping non-mutually exclusive variables into categories in one variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853445#M42231</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I have this survey data that includes checkboxes (select all that apply), and I am trying to create a new variable that groups all of these separate variables into a new variable. An individual can check more than one role or facility. I am new with SAS, and I know using "Else if" would not give the right frequencies (since its for mutually exclusive responses). Initially, I was going to use macro since I had a lot of variables to recategorize, but I couldn't get it to work so I decided to go with this but still not getting the right frequencies for each category. Can anyone help correct the code below, and let me know what I might be doing wrong thank you? SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*creating a new category called "respondent's role"*;&lt;BR /&gt;Data FSurvey1;&lt;BR /&gt;set FSurvey;&lt;BR /&gt;if respondent_role___1= 1 then role=1;&lt;BR /&gt;if respondent_role___2= 1 then role=2;&lt;BR /&gt;if respondent_role___3= 1 then role=3;&lt;BR /&gt;if respondent_role___4= 1 then role=4;&lt;BR /&gt;if respondent_role___5= 1 then role=5;&lt;BR /&gt;if respondent_role___6= 1 then role=6;&lt;BR /&gt;if respondent_role___7= 1 then role=7;&lt;BR /&gt;if respondent_role___8= 1 then role=8;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;*creating a new category called "facilities description"*;&lt;BR /&gt;if facility_description___1= 1 then facility=1;&lt;BR /&gt;if facility_description___2= 1 then facility=2;&lt;BR /&gt;if facility_description___3= 1 then facility=3;&lt;BR /&gt;if facility_description___4= 1 then facility=4;&lt;BR /&gt;if facility_description___5= 1 then facility=5;&lt;BR /&gt;if facility_description___6= 1 then facility=6;&lt;BR /&gt;if facility_description___7= 1 then facility=7;&lt;BR /&gt;if facility_description___8= 1 then facility=8;&lt;BR /&gt;format facility facility.&amp;nbsp;role role.;&lt;BR /&gt;run;&lt;BR /&gt;proc freq data= FSurvey1;&lt;BR /&gt;tables facility role;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 14:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853445#M42231</guid>
      <dc:creator>aayomiposi</dc:creator>
      <dc:date>2023-01-12T14:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping non-mutually exclusive variables into categories in one variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853450#M42232</link>
      <description>&lt;P&gt;So, if for a given respondent, the value of&amp;nbsp;&lt;SPAN&gt;respondent_role___1 is equal to 1 and the value of&amp;nbsp;respondent_role___3 is equal to 1 and the value of&amp;nbsp;respondent_role___5 is equal to 1, what result do you want?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Would this work?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data= FSurvey1;
tables facility_desc: respondent_role: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jan 2023 14:30:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853450#M42232</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-12T14:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping non-mutually exclusive variables into categories in one variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853456#M42233</link>
      <description>&lt;P&gt;Thank you for your response. That worked and I got this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aayomiposi_0-1673534999061.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79315i86B43E5E3635F78C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aayomiposi_0-1673534999061.png" alt="aayomiposi_0-1673534999061.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, 0= unchecked, and 1= checked, meaning that for each of those variables for example respondent role__1, we have 1 and 0. All of the different variables should be in a variable as categories and not as an individual variable. So i need SAS to count everyone that checked role 1 as one category irrespective of if they checked other roles.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 14:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853456#M42233</guid>
      <dc:creator>aayomiposi</dc:creator>
      <dc:date>2023-01-12T14:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping non-mutually exclusive variables into categories in one variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853462#M42234</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438425"&gt;@aayomiposi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, 0= unchecked, and 1= checked, meaning that for each of those variables for example respondent role__1, we have 1 and 0. All of the different variables should be in a variable as categories and not as an individual variable. So i need SAS to count everyone that checked role 1 as one category irrespective of if they checked other roles.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand these words. Categories that look like what? SHOW US what you want.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 14:52:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853462#M42234</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-12T14:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping non-mutually exclusive variables into categories in one variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853467#M42235</link>
      <description>&lt;P&gt;So when I use this code&lt;BR /&gt;Data FoamSurvey1;&lt;BR /&gt;set FoamSurvey;&lt;BR /&gt;if respondent_role___1= 1 then role=1;&lt;BR /&gt;if respondent_role___2= 1 then role=2;&lt;BR /&gt;if respondent_role___3= 1 then role=3;&lt;BR /&gt;if respondent_role___4= 1 then role=4;&lt;BR /&gt;if respondent_role___5= 1 then role=5;&lt;BR /&gt;if respondent_role___6= 1 then role=6;&lt;BR /&gt;if respondent_role___7= 1 then role=7;&lt;BR /&gt;if respondent_role___8= 1 then role=8;&lt;BR /&gt;format role roles.&lt;BR /&gt;run;&lt;BR /&gt;proc freq data= FoamSurvey1;&lt;BR /&gt;tables role;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aayomiposi_0-1673535752590.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79319i5A1C80A823376681/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aayomiposi_0-1673535752590.png" alt="aayomiposi_0-1673535752590.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is how I want it categorized. However, it is not correct. State fire training director should be 11 not 10, deputy fire chief should be 10 not 8.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 15:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853467#M42235</guid>
      <dc:creator>aayomiposi</dc:creator>
      <dc:date>2023-01-12T15:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping non-mutually exclusive variables into categories in one variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853469#M42236</link>
      <description>&lt;P&gt;Okay, I think I understand. I believe this is what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data FoamSurvey1;
set FoamSurvey;
if respondent_role___1= 1 then do; role=1; output; end;
if respondent_role___2= 1 then do; role=2; output; end;
if respondent_role___3= 1 then do; role=3; output; end;
if respondent_role___4= 1 then do; role=4; output; end;
if respondent_role___5= 1 then do; role=5; output; end;
if respondent_role___6= 1 then do; role=6; output; end;
if respondent_role___7= 1 then do; role=7; output; end;
if respondent_role___8= 1 then do; role=8; output; end;
format role roles.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jan 2023 15:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853469#M42236</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-12T15:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping non-mutually exclusive variables into categories in one variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853471#M42237</link>
      <description>Thank you so much. It worked. I appreciate your help and patience.</description>
      <pubDate>Thu, 12 Jan 2023 15:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Grouping-non-mutually-exclusive-variables-into-categories-in-one/m-p/853471#M42237</guid>
      <dc:creator>aayomiposi</dc:creator>
      <dc:date>2023-01-12T15:13:03Z</dc:date>
    </item>
  </channel>
</rss>

