<?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 output in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824481#M40843</link>
    <description>&lt;P&gt;Another approach to the display non-decimal values with % sign is a custom format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   value = 68.1234567;
run;

proc format;
picture p2dec
low-high ='00009.99%';
run;

proc print data=example;
   format value p2dec.;
run;&lt;/PRE&gt;
&lt;P&gt;The Picture format uses digit selectors where 9 indicates positions that will be displayed, using a 0 if no value in that position in the value and the % character is tacked onto the end. There are a number of options that are available as well. But this is not a standard supplied SAS format because the range of values you want might be different that SAS would create for a default. Also you can modify this for different ranges such as value of 0. Many people find things like 0.00% odd at best and possibly confusing. You could create custom ranges such that 0 (exactly 0) displays as a nicer 0% and 100 displays as 100% instead of 100.00%. Or even '&amp;lt;.01%' or similar which might be important if you have a number of very small values that would using either the Percent8.2 or my custom format display 0.00%. Nothing like showing 10 items of 0.00% with a total of 0.02% to confuse readers.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2022 20:06:32 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-07-20T20:06:32Z</dc:date>
    <item>
      <title>Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824410#M40833</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following Freq statement to output proportion of tested persons with 5-10 days from exposure date. Follows is the code and the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = merged;&lt;BR /&gt;tables Tested_Within_5to10days/norow nocol nofreq nocum out= Tested_Proportion;&lt;BR /&gt;title 'Proportion of contacts tested in the 5-10 day window of quarantine period';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is the table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayasak_0-1658334137543.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73536i8FAB914E2893C2A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayasak_0-1658334137543.png" alt="mayasak_0-1658334137543.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there a way that I get a more representable table with&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A percent 16.7% for percent of total instead of 16.666666667&lt;/LI&gt;&lt;LI&gt;C&lt;SPAN&gt;hange the heading "viewtable:work.tested_proportion(frequency...)"&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Change the column names&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Remove a column such as the column with 1 an 2 or the Tested_within_5to10days.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 16:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824410#M40833</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-07-20T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824417#M40834</link>
      <description>&lt;P&gt;I wonder whether you're confusing the normal &lt;EM&gt;&lt;STRONG&gt;displayed/printed output&lt;/STRONG&gt;&lt;/EM&gt; of proc freq results with a data viewer display of the &lt;EM&gt;&lt;STRONG&gt;output data set&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; It's the latter you are showing.&amp;nbsp; But perhaps it's the earlier you want, commonly found in the &lt;STRONG&gt;Results Viewer&lt;/STRONG&gt; tab.&amp;nbsp; It won't have row numbers displayed, and the percentage display will be more viewer-friendly.&amp;nbsp; You'll also get the title you specified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 16:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824417#M40834</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-07-20T16:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824418#M40835</link>
      <description>&lt;P&gt;Most of what you request can be done in a data step using the Tested_proportion data set.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A percent 16.7% for percent of total instead of 16.666666667 - either change the format or modify the value and assign format. The percents in the result are your value so you could divide by 100, to get the decimal version of the percentage and assign a format like Percent8.1 if you want to see % signs.&lt;/LI&gt;
&lt;LI&gt;C&lt;SPAN&gt;hange the heading "viewtable:work.tested_proportion(frequency...)" - Label statement to change heading for a variable OR a data set label option to assign one to a data set: &lt;BR /&gt;&lt;/SPAN&gt;
&lt;PRE&gt;data somename (label='Desired data set label text');
   set sourcedataset;
run;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Change the column names - Rename statement &lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Remove a column such as the column with 1 an 2 or the Tested_within_5to10days. - Not sure exactly what you mean. A "column" or variable is either in a data set or not, nothing conditional. An IF statement could test values of one or more variables and set variables to missing or delete an observation.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 20 Jul 2022 16:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824418#M40835</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-20T16:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824419#M40836</link>
      <description>Hi mkeintz,&lt;BR /&gt;Thank you for the response.&lt;BR /&gt;No. I'm talking about the output data set.</description>
      <pubDate>Wed, 20 Jul 2022 16:57:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824419#M40836</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-07-20T16:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824422#M40837</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;You can post-process the output data set from PROC FREQ&lt;/P&gt;
&lt;P&gt;with PROC DATASETS and MODIFY statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS® 9.4 and SAS® Viya® 3.5 Programming Documentation | SAS 9.4 / Viya 3.5&lt;BR /&gt;Base SAS Procedures Guide&lt;BR /&gt;DATASETS Procedure&lt;BR /&gt;MODIFY Statement&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0ahh0eqtadmp3n1uwv55i2gyxiz.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0ahh0eqtadmp3n1uwv55i2gyxiz.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example 4: Modifying SAS Data Sets&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0mfav25learpan1lerk79jsp30n.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0mfav25learpan1lerk79jsp30n.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PROC DATASETS does not process the body of the data set (the data portion).&lt;BR /&gt;It's only dealing with the metadata portion.&lt;BR /&gt;So, dropping a columns CANNOT be done with PROC DATASETS (use PROC SQL or data step instead).&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Koen&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 17:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824422#M40837</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-07-20T17:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824440#M40838</link>
      <description>&lt;P&gt;Thank you ballardw,&lt;/P&gt;&lt;P&gt;I updated the percentage and changed the label by using this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = merged;&lt;BR /&gt;tables Tested_Within_5to10days/norow nocol nofreq nocum totpct outpct list out= Proportion;&lt;BR /&gt;format percent 8.1;&lt;BR /&gt;title 'Proportion of contacts tested in the 5-10 day window of quarantine period';&lt;BR /&gt;run;&lt;BR /&gt;data prop (label='Proportion Tested');&lt;BR /&gt;set proportion;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I got this table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayasak_0-1658340934724.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73538i0D5FACD2B9C616A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayasak_0-1658340934724.png" alt="mayasak_0-1658340934724.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Much better but still I don't how to get the % sign format, I'm getting either 16.7 when I use '8.1' or 1667% when I use percent8.1 format, you mentioned using division by 100, how this could be done with the percent8.1 format?&lt;/P&gt;&lt;P&gt;Also, for changing the column name, I'm not sure where to add the renew statement?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 18:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824440#M40838</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-07-20T18:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824443#M40839</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;data prop (label='Proportion Tested');
   set proportion;
   percent= percent/100;
   format percent percent8.1;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jul 2022 18:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824443#M40839</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-20T18:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824450#M40840</link>
      <description>Yesss it worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;Just I couldn't change the "frequency count" and the "percent of total frequency" in the output table. Maybe it's not doable!&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jul 2022 19:21:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824450#M40840</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-07-20T19:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824453#M40841</link>
      <description>&lt;PRE&gt;data prop (label='Proportion Tested');
   set proportion;
   percent= percent/100;
   format percent percent8.1;
   label
      percent = 'Text for percent label'
      count    = 'Text for count label'
   ;
run;&lt;/PRE&gt;
&lt;P&gt;Makes permanent changes to the default label.&lt;/P&gt;
&lt;P&gt;You can override the label in most procedure output by adding a LABEL statement in the body of the Procedure code using syntax just like that for the data step. Label and Format can be set in almost every procedure to something other than the defaults.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 19:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824453#M40841</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-20T19:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824470#M40842</link>
      <description>Thank you so much.</description>
      <pubDate>Wed, 20 Jul 2022 19:50:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824470#M40842</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-07-20T19:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824481#M40843</link>
      <description>&lt;P&gt;Another approach to the display non-decimal values with % sign is a custom format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   value = 68.1234567;
run;

proc format;
picture p2dec
low-high ='00009.99%';
run;

proc print data=example;
   format value p2dec.;
run;&lt;/PRE&gt;
&lt;P&gt;The Picture format uses digit selectors where 9 indicates positions that will be displayed, using a 0 if no value in that position in the value and the % character is tacked onto the end. There are a number of options that are available as well. But this is not a standard supplied SAS format because the range of values you want might be different that SAS would create for a default. Also you can modify this for different ranges such as value of 0. Many people find things like 0.00% odd at best and possibly confusing. You could create custom ranges such that 0 (exactly 0) displays as a nicer 0% and 100 displays as 100% instead of 100.00%. Or even '&amp;lt;.01%' or similar which might be important if you have a number of very small values that would using either the Percent8.2 or my custom format display 0.00%. Nothing like showing 10 items of 0.00% with a total of 0.02% to confuse readers.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 20:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824481#M40843</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-20T20:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824482#M40844</link>
      <description>Is there a way to widen the columns?&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jul 2022 20:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824482#M40844</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-07-20T20:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq output</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824487#M40845</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/47035"&gt;@mayasak&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Is there a way to widen the columns?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you mean in the Viewtable window not with code so much. With the window open you can move your cursor to the top row with the labels/variable names and when placed correctly drag the column boundary.&lt;/P&gt;
&lt;P&gt;If you have a Viewtable open you should have some appearance options on the VIEW menu that may be of interest such as Form view that will attempt to show one observation as a page. Note that the size of the page is that of the window. So you may have to 1) drag borders to get a larger window, 2) close the window, 3)reopen the window to use the larger size.&lt;/P&gt;
&lt;P&gt;This assumes you are using a Display Manager or sometimes called Foundation, Base or PC SAS session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 20:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Freq-output/m-p/824487#M40845</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-20T20:22:19Z</dc:date>
    </item>
  </channel>
</rss>

