<?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: Best Way to Do a Frequency Table for Patient Responses in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/948129#M371042</link>
    <description>&lt;P&gt;data pizza_likes;&lt;BR /&gt;input ID $ A $ B $;&lt;BR /&gt;datalines;&lt;BR /&gt;21 Yes No&lt;BR /&gt;22 No No&lt;BR /&gt;23 Yes Yes&lt;BR /&gt;24 No Yes&lt;BR /&gt;25 Yes Yes&lt;BR /&gt;26 Yes No&lt;BR /&gt;27 No Yes&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=pizza_likes;&lt;BR /&gt;tables A*B / nocol nopercent norow;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select &lt;BR /&gt;sum(A='Yes') as Likes_A,&lt;BR /&gt;sum(B='Yes') as Likes_B,&lt;BR /&gt;sum(A='Yes' and B='No') as Likes_Only_A,&lt;BR /&gt;sum(A='No' and B='Yes') as Likes_Only_B,&lt;BR /&gt;sum(A='Yes' and B='Yes') as Likes_Both,&lt;BR /&gt;sum(A='No' and B='No') as Likes_Neither,&lt;BR /&gt;sum(A='Yes' or B='Yes') as Likes_Either&lt;BR /&gt;from pizza_likes;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Oct 2024 20:13:37 GMT</pubDate>
    <dc:creator>JOL</dc:creator>
    <dc:date>2024-10-18T20:13:37Z</dc:date>
    <item>
      <title>Best Way to Do a Frequency Table for Patient Responses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/947994#M371009</link>
      <description>&lt;P&gt;I have a data set of hospital patient IDs, and the data shows which of 2 pizza brands (Brand A or B) each unique individual like (they can like one, both, or neither). It looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ID&amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; B

21&amp;nbsp; &amp;nbsp;Yes&amp;nbsp; No
22&amp;nbsp; No&amp;nbsp; &amp;nbsp;No
23&amp;nbsp; Yes&amp;nbsp; Yes
24&amp;nbsp; No&amp;nbsp; &amp;nbsp;Yes
25&amp;nbsp; Yes&amp;nbsp; Yes
26&amp;nbsp; Yes&amp;nbsp; No
27&amp;nbsp; No&amp;nbsp; &amp;nbsp;Yes
.
.
.
.

;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, based on that data, I want to know how many patients liked A, B, only A, only B, both, neither one, either one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's an effecient approach to this? I was thinking of doing a table where the columns are for A and B, then the rows are Yes or No. Then for each entry, it will have the count of yes/no for A and yes/no for B, but that doesn't seem to be very helpful in showing a report that gives me what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on what I can code to produce a report with those values?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 04:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/947994#M371009</guid>
      <dc:creator>unwashedhelimix</dc:creator>
      <dc:date>2024-10-18T04:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Best Way to Do a Frequency Table for Patient Responses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/948020#M371018</link>
      <description>&lt;P&gt;Combine the variables A and B into a single variable. Then run PROC FREQ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
    set have;
    ab=cats(A,'|',B);
run;
proc freq data=have1;
    tables ab;
run;&lt;/CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 10:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/948020#M371018</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-10-18T10:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Best Way to Do a Frequency Table for Patient Responses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/948044#M371025</link>
      <description>&lt;P&gt;My approach is similar to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; only uses an option on tables statement that doesn't require creating a new variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc freq data=have;
   tables a*b / missing list ;
run;&lt;/PRE&gt;
&lt;P&gt;I include Missing so if you have any missing values they appear in the body of the report table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/470428"&gt;@unwashedhelimix&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a data set of hospital patient IDs, and the data shows which of 2 pizza brands (Brand A or B) each unique individual like (they can like one, both, or neither). It looks something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID&amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; B

21&amp;nbsp; &amp;nbsp;Yes&amp;nbsp; No
22&amp;nbsp; No&amp;nbsp; &amp;nbsp;No
23&amp;nbsp; Yes&amp;nbsp; Yes
24&amp;nbsp; No&amp;nbsp; &amp;nbsp;Yes
25&amp;nbsp; Yes&amp;nbsp; Yes
26&amp;nbsp; Yes&amp;nbsp; No
27&amp;nbsp; No&amp;nbsp; &amp;nbsp;Yes
.
.
.
.

;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, based on that data, I want to know how many patients liked A, B, only A, only B, both, neither one, either one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's an effecient approach to this? I was thinking of doing a table where the columns are for A and B, then the rows are Yes or No. Then for each entry, it will have the count of yes/no for A and yes/no for B, but that doesn't seem to be very helpful in showing a report that gives me what I want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas on what I can code to produce a report with those values?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 17:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/948044#M371025</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-10-18T17:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Best Way to Do a Frequency Table for Patient Responses</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/948129#M371042</link>
      <description>&lt;P&gt;data pizza_likes;&lt;BR /&gt;input ID $ A $ B $;&lt;BR /&gt;datalines;&lt;BR /&gt;21 Yes No&lt;BR /&gt;22 No No&lt;BR /&gt;23 Yes Yes&lt;BR /&gt;24 No Yes&lt;BR /&gt;25 Yes Yes&lt;BR /&gt;26 Yes No&lt;BR /&gt;27 No Yes&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=pizza_likes;&lt;BR /&gt;tables A*B / nocol nopercent norow;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;select &lt;BR /&gt;sum(A='Yes') as Likes_A,&lt;BR /&gt;sum(B='Yes') as Likes_B,&lt;BR /&gt;sum(A='Yes' and B='No') as Likes_Only_A,&lt;BR /&gt;sum(A='No' and B='Yes') as Likes_Only_B,&lt;BR /&gt;sum(A='Yes' and B='Yes') as Likes_Both,&lt;BR /&gt;sum(A='No' and B='No') as Likes_Neither,&lt;BR /&gt;sum(A='Yes' or B='Yes') as Likes_Either&lt;BR /&gt;from pizza_likes;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 20:13:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-Way-to-Do-a-Frequency-Table-for-Patient-Responses/m-p/948129#M371042</guid>
      <dc:creator>JOL</dc:creator>
      <dc:date>2024-10-18T20:13:37Z</dc:date>
    </item>
  </channel>
</rss>

