<?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 Grouping in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605519#M175756</link>
    <description>&lt;P&gt;So this works great! What if I want to add patientID as a grouping?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2019 20:31:09 GMT</pubDate>
    <dc:creator>shoeGirl37</dc:creator>
    <dc:date>2019-11-19T20:31:09Z</dc:date>
    <item>
      <title>Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605196#M175582</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a table that I need to find the frequencies of patient appointments based on group of diagnosis.&lt;/P&gt;&lt;P&gt;I have the table set up where it's showing the months and counts of the appointments and also grouped by diagnosis category, I just need to break it down by each department.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to do BY dept or include dept in the matrix, it's giving me 153 tables with every dx category.&lt;/P&gt;&lt;P&gt;Not every dept has every category.&lt;/P&gt;&lt;P&gt;I just need to have the freq for each dept but only the diagnosis included in that dept.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;FONT&gt;proc freq data=cplr.patientICD9Analysis4;&lt;BR /&gt;format Appt_Date monyy7.;&lt;BR /&gt;table DeptID*Diagnosis_Category*Appt_Date / nocol nocum norow;&lt;BR /&gt;where Provider_Type IN ("Physician", "Resident", "Fellow");&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT&gt;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any help would be appreciated&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605196#M175582</guid>
      <dc:creator>shoeGirl37</dc:creator>
      <dc:date>2019-11-18T20:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605199#M175584</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;table DeptID*Diagnosis_Category*Appt_Date / list;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605199#M175584</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-18T20:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605201#M175586</link>
      <description>&lt;P&gt;that is good, but is there a way to have it more in a table format?&lt;/P&gt;&lt;P&gt;seems long....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605201#M175586</guid>
      <dc:creator>shoeGirl37</dc:creator>
      <dc:date>2019-11-18T20:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605202#M175587</link>
      <description>&lt;P&gt;"table format"? Can you give an example? Do you want it in a SAS data set?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605202#M175587</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-18T20:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605203#M175588</link>
      <description>&lt;P&gt;I think when proc freq outputs it's divided by dept, it shows me a proc freq output for each dept which is good, but it also outputs all the diagnosis categories.&lt;/P&gt;&lt;P&gt;Is there an output where each table output will only limit to the diagnosis categories part of that dept and not all of them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605203#M175588</guid>
      <dc:creator>shoeGirl37</dc:creator>
      <dc:date>2019-11-18T20:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605205#M175590</link>
      <description>&lt;P&gt;and I would like to output it to excel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 20:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605205#M175590</guid>
      <dc:creator>shoeGirl37</dc:creator>
      <dc:date>2019-11-18T20:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605208#M175592</link>
      <description>&lt;P&gt;Maybe this? This creates a SAS data set named _COUNTS_ as output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=cplr.patientICD9Analysis4;
format Appt_Date monyy7.;
by deptid;
table Diagnosis_Category*Appt_Date / noprint list out=_counts_;
where Provider_Type IN ("Physician", "Resident", "Fellow");
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2019 21:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605208#M175592</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-18T21:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605216#M175599</link>
      <description>&lt;P&gt;If you provide some example data we might get closer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't need cumulative counts or percentages then Proc tabulate might be what you are looking for.&lt;/P&gt;
&lt;P&gt;Try this and see if one is closer to what you want: Proc tabulate can have multiple table statements . The comma indicates a dimension. So the first will have a row heading or department id and date with separate columns for diagnosis category.&lt;/P&gt;
&lt;P&gt;The second table would be one "page", or table,&amp;nbsp;per department with rows of date and columns of diagnosis, and the third is rows of diagnosis category and date with columns for department. Tabulate has a number of different percentages so without knowing which makes sense I'm not going to confuse that issue.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data= data=cplr.patientICD9Analysis4;
format Appt_Date monyy7.;
class DeptID Diagnosis_Category Appt_Date ;
where Provider_Type IN ("Physician", "Resident", "Fellow");

table DeptID*Appt_Date ,
      Diagnosis_Category * n;
/*or*/
table DeptID,
      Appt_Date ,
      Diagnosis_Category * n;
/*or */
table Diagnosis_Category*Appt_Date ,
      deptID * n;


run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2019 21:37:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605216#M175599</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-18T21:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605219#M175602</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_freq_syntax08.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en#statug.freq.freqcrosslist" target="_self"&gt;CROSSLIST&lt;/A&gt;&amp;nbsp;format together with the&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_freq_syntax08.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en#statug.freq.freqnosparse" target="_self"&gt;NOSPARSE&lt;/A&gt;&amp;nbsp;option in the TABLES statement (in PROC FREQ).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tables DeptID*Diagnosis_Category*Appt_Date / crosslist nosparse;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 21:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605219#M175602</guid>
      <dc:creator>Watts</dc:creator>
      <dc:date>2019-11-18T21:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605519#M175756</link>
      <description>&lt;P&gt;So this works great! What if I want to add patientID as a grouping?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605519#M175756</guid>
      <dc:creator>shoeGirl37</dc:creator>
      <dc:date>2019-11-19T20:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq Grouping</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605543#M175763</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/300212"&gt;@shoeGirl37&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So this works great! What if I want to add patientID as a grouping?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Depends on where you want it to appear and how a variable is to be used. That is partially why I mentioned which examples have which things appear in a row, column or page heading. Within any of the dimensions the code when read from left to right with nesting (the *) means that for rows (or page) that the variable values will appear in left to right order. If the dimension is a column dimension then the left most variable would be at the top of a group with the nested values below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For simple counts I would suggest playing around with the variables in a smallish data set like SASHELP.Class or SASHELP.CARS and place the group-like variables in different orders with and without * for nesting and/or ( ) around groups of variables to see what happens. Or read the friendly manual. There are enough concepts involved that SAS publishes a book just on Proc Tabulate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also Proc Report is very flexible with different approaches to layout. There are tradeoffs in both procedures, Tabulate is probably nicer when you need to nest results in both rows and columns but you can't request statistics in both the row and column generally.&lt;/P&gt;
&lt;P&gt;Proc Report allows more flexibility in using values from columns to calculate values in other columns &lt;STRONG&gt;to the right&lt;/STRONG&gt; in a table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate needs to know how a variable will be used: Grouping usually means the variable goes on a Class statement, if the variable is be used in statistics other than N related, such as Mean, Max, Stddev then the variable needs to be on a VAR statement.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 21:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-Grouping/m-p/605543#M175763</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-19T21:37:02Z</dc:date>
    </item>
  </channel>
</rss>

