<?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: Question about &amp;quot;Proc Freq&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-quot-Proc-Freq-quot/m-p/442714#M282771</link>
    <description>&lt;P&gt;The answer depends on two factors, taken together:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The definition of the $TYP format, plus&lt;/LI&gt;
&lt;LI&gt;The actual values of BookType&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Within the groupings defined by $TYP, SAS is storing all the values in each group using a single value.&amp;nbsp; For example, part of the format definition might be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'sci', 'bio', 'non', 'ref' = 'Non-Fiction'&lt;/P&gt;
&lt;P&gt;'fic', 'mys' = 'Fiction'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS stores the Non-Fiction category using the smallest of the four values (sci bio non ref) that is actually found in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do have control over that, since PROC FREQ supports the ORDER= option.&amp;nbsp; The default is INTERNAL (order by the internal value of the values).&amp;nbsp; But you can switch to ORDER=FORMATTED to force Fiction to print before Non-Fiction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly, SAS stores the Fiction category using the smallest of the two values (fic mys) that is actually found in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The order of the rows is determined by the smallest value in the data for each category, and prints in that order.&amp;nbsp; So depending on the values found in the data, the row order could change.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 02:57:01 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-03-06T02:57:01Z</dc:date>
    <item>
      <title>Question about "Proc Freq"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-quot-Proc-Freq-quot/m-p/442703#M282770</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Create two way table with Age grouped into two categories;
PROC FREQ DATA = books;
   TITLE 'Patron Age by Book Type: Two Age Groups';
   TABLES BookType * Age / NOPERCENT NOROW NOCOL;
   FORMAT Age agegpb. BookType $typ.;
RUN;


/* How does PROC FREQ order the categories? For example,
	why does Non-Fiction get listed before Fiction?&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The data-set is as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;17 sci 9 bio 28 fic 50 mys 13 fic 32 fic 67 fic 81 non 38 non&lt;BR /&gt;53 non 16 sci 15 bio 61 fic 52 ref 22 mys 76 bio 37 fic 86 fic&lt;BR /&gt;49 mys 78 non 45 sci 64 bio 8 fic 11 non 41 fic 46 ref 69 fic&lt;BR /&gt;34 fic 26 mys 23 sci 74 ref 15 sci 27 fic 23 mys 63 fic 78 non&lt;BR /&gt;40 bio 12 fic 29 fic 54 mys 67 fic 60 fic 38 sci 42 fic 80 fic&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder how to answer the question:&lt;/P&gt;&lt;P&gt;"Why does Non-Fiction get listed before Fiction"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 01:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-quot-Proc-Freq-quot/m-p/442703#M282770</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-03-06T01:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question about "Proc Freq"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-quot-Proc-Freq-quot/m-p/442714#M282771</link>
      <description>&lt;P&gt;The answer depends on two factors, taken together:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The definition of the $TYP format, plus&lt;/LI&gt;
&lt;LI&gt;The actual values of BookType&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Within the groupings defined by $TYP, SAS is storing all the values in each group using a single value.&amp;nbsp; For example, part of the format definition might be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'sci', 'bio', 'non', 'ref' = 'Non-Fiction'&lt;/P&gt;
&lt;P&gt;'fic', 'mys' = 'Fiction'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS stores the Non-Fiction category using the smallest of the four values (sci bio non ref) that is actually found in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do have control over that, since PROC FREQ supports the ORDER= option.&amp;nbsp; The default is INTERNAL (order by the internal value of the values).&amp;nbsp; But you can switch to ORDER=FORMATTED to force Fiction to print before Non-Fiction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly, SAS stores the Fiction category using the smallest of the two values (fic mys) that is actually found in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The order of the rows is determined by the smallest value in the data for each category, and prints in that order.&amp;nbsp; So depending on the values found in the data, the row order could change.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 02:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-quot-Proc-Freq-quot/m-p/442714#M282771</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-06T02:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Question about "Proc Freq"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-quot-Proc-Freq-quot/m-p/442718#M282772</link>
      <description>&lt;P&gt;Thank you!!&lt;/P&gt;&lt;P&gt;Very clear!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 03:03:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-quot-Proc-Freq-quot/m-p/442718#M282772</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-03-06T03:03:32Z</dc:date>
    </item>
  </channel>
</rss>

