<?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: Proc Freq: Combining Rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682466#M206572</link>
    <description>&lt;P&gt;You don't have to change values in your data to create 3 groups from 5.&amp;nbsp; Instead you can define a FORMAT that collapses values, and tell proc freq to honor that format, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value $myfmt 'A','B' = 'AB: disatisfied'
               'D','E' = 'DE: satisfied' ;
run;
proc freq data=have;
  tables ques1 ques2;
  format ques1 ques2 $myfmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I've assumed the actual values in ques1 and ques2 are 'A','B','C','D'; and 'E'.&amp;nbsp; If not change the value statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 01:15:56 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2020-09-09T01:15:56Z</dc:date>
    <item>
      <title>Proc Freq: Combining Rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682465#M206571</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm having some troubles regarding a procedure using Proc Freq.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating tables based on survey questions that are organized by sex, and would like to combine some of the rows that have similar responses to create more general row labels.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;Question 1: rate your level of satisfaction with your current living arrangement&lt;/P&gt;&lt;P&gt;A) Extremely Dissatisfied&lt;/P&gt;&lt;P&gt;B) Dissatisfied&lt;/P&gt;&lt;P&gt;C) Neutral&lt;/P&gt;&lt;P&gt;D) Satisfied&lt;/P&gt;&lt;P&gt;E) Somewhat Satisfied&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like a table that combines responses from A and B to create one row being "dissatisfied", and do the same for responses D and E.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created my code using proc freq:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;freq&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = work.living;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;table&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#800080"&gt;'1-Rate your Satisfaction with y'n&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;*&lt;FONT color="#800080"&gt;'What is your gender?'n&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;/ &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;nocum&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;nocol&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;norow&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;all data is organize by gender of the respondent.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;any help is appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 01:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682465#M206571</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2020-09-09T01:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq: Combining Rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682466#M206572</link>
      <description>&lt;P&gt;You don't have to change values in your data to create 3 groups from 5.&amp;nbsp; Instead you can define a FORMAT that collapses values, and tell proc freq to honor that format, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value $myfmt 'A','B' = 'AB: disatisfied'
               'D','E' = 'DE: satisfied' ;
run;
proc freq data=have;
  tables ques1 ques2;
  format ques1 ques2 $myfmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I've assumed the actual values in ques1 and ques2 are 'A','B','C','D'; and 'E'.&amp;nbsp; If not change the value statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 01:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682466#M206572</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-09-09T01:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq: Combining Rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682469#M206575</link>
      <description>&lt;P&gt;Create a format that combines the values into the same group, and apply the format to the variable in the proc freq.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 01:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682469#M206575</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-09-09T01:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq: Combining Rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682634#M206634</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt; - do you think you could provide an example? I tried doing so and it doesn't seem to be working...&lt;BR /&gt;thanks!</description>
      <pubDate>Wed, 09 Sep 2020 13:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682634#M206634</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2020-09-09T13:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq: Combining Rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682637#M206636</link>
      <description>&lt;P&gt;An example was already provided by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 14:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682637#M206636</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-09T14:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq: Combining Rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682644#M206639</link>
      <description>for the last format statement (under the proc freq), my tables are multi-way (for example):&lt;BR /&gt;proc freq data = work.living;&lt;BR /&gt;table '1-Rate your Satisfaction with y'n*'What is your gender?'n / nocum nocol norow;'&lt;BR /&gt;&lt;BR /&gt;how would I use the format function under "proc freq" using the table above?&lt;BR /&gt;&lt;BR /&gt;Im receiving errors when trying to do so.</description>
      <pubDate>Wed, 09 Sep 2020 14:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682644#M206639</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2020-09-09T14:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq: Combining Rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682649#M206642</link>
      <description>&lt;P&gt;Show us the log so we can see the errors (and the code you used as well).&lt;FONT size="2"&gt;&amp;nbsp;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: #333333;"&gt;When providing the log, it is critical that you maintain the formatting of the log so we can see it exactly as SAS showed it to you, making it easier for us to use. To maintain the formatting of the log, click on the &amp;lt;/&amp;gt; icon and paste the log as text into the window that appears. DO NOT SKIP THIS STEP.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 14:21:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Combining-Rows/m-p/682649#M206642</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-09T14:21:37Z</dc:date>
    </item>
  </channel>
</rss>

