<?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 How to use proc format for columns in the output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/729974#M227242</link>
    <description>&lt;P&gt;I have the following data&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;BR /&gt;input year dz $8. area;&lt;BR /&gt;cards;&lt;BR /&gt;2000 stroke 08&lt;BR /&gt;2000 stroke 06&lt;BR /&gt;2000 stroke 06&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After using the proc tabulate&lt;/P&gt;&lt;P&gt;proc tabulate data=have;&lt;BR /&gt;class area dz;&lt;BR /&gt;table area, dz*(n colpctn);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I get the below output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Priyamvada07_0-1617084939992.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56651i9C749812F48E3D46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Priyamvada07_0-1617084939992.png" alt="Priyamvada07_0-1617084939992.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to replace any values below 5 in "N" column and 0 in "ColPctN" column with "&amp;lt;5" and "0", respectively.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below proc format code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;proc format;&lt;BR /&gt;picture count (round)&lt;BR /&gt;0-4 = ' &amp;lt;5' (NOEDIT);&lt;BR /&gt;picture pcnt (round)&lt;BR /&gt;0 = ' - '&lt;BR /&gt;other = '009.9%';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am not understanding how to use it in the data step to get the desired results. Please guide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 06:21:15 GMT</pubDate>
    <dc:creator>Priyamvada07</dc:creator>
    <dc:date>2021-03-30T06:21:15Z</dc:date>
    <item>
      <title>How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/729974#M227242</link>
      <description>&lt;P&gt;I have the following data&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;BR /&gt;input year dz $8. area;&lt;BR /&gt;cards;&lt;BR /&gt;2000 stroke 08&lt;BR /&gt;2000 stroke 06&lt;BR /&gt;2000 stroke 06&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After using the proc tabulate&lt;/P&gt;&lt;P&gt;proc tabulate data=have;&lt;BR /&gt;class area dz;&lt;BR /&gt;table area, dz*(n colpctn);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I get the below output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Priyamvada07_0-1617084939992.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56651i9C749812F48E3D46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Priyamvada07_0-1617084939992.png" alt="Priyamvada07_0-1617084939992.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to replace any values below 5 in "N" column and 0 in "ColPctN" column with "&amp;lt;5" and "0", respectively.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below proc format code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;proc format;&lt;BR /&gt;picture count (round)&lt;BR /&gt;0-4 = ' &amp;lt;5' (NOEDIT);&lt;BR /&gt;picture pcnt (round)&lt;BR /&gt;0 = ' - '&lt;BR /&gt;other = '009.9%';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am not understanding how to use it in the data step to get the desired results. Please guide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 06:21:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/729974#M227242</guid>
      <dc:creator>Priyamvada07</dc:creator>
      <dc:date>2021-03-30T06:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730000#M227258</link>
      <description>&lt;P&gt;Next code demonstrates the usage of format in proc tabulate:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA HAVE;
input year dz $8. area;
cards;
2000 stroke 08
2000 stroke 06
2000 stroke 06
;
run;
proc format;
picture count (round)
0-4 = ' &amp;lt;5' (NOEDIT);
picture pcnt (round)
0 = ' - '
other = '009.9%';
run;
proc tabulate data=have;
class area dz;
table area, dz*(n*f=count. colpctn*f=pcnt.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Mar 2021 08:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730000#M227258</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-30T08:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730144#M227322</link>
      <description>Thank you Shmuel! This works, however I was wondering how to use it in proc freq, I tried using it this way&lt;BR /&gt;proc freq data=have;&lt;BR /&gt;tables area * dz / list nocum (frequency=fcount. percent=pcnt.);&lt;BR /&gt;run;.&lt;BR /&gt;But it doesn't work!</description>
      <pubDate>Tue, 30 Mar 2021 17:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730144#M227322</guid>
      <dc:creator>Priyamvada07</dc:creator>
      <dc:date>2021-03-30T17:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730155#M227327</link>
      <description>&lt;P&gt;With proc freq try - though I am sceptic about variable names to use:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
format frequency fcount.  percent pcnt.;
tables area * dz / list nocum ;
run;.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Mar 2021 17:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730155#M227327</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-30T17:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730176#M227342</link>
      <description>When I do that it doesn't work!&lt;BR /&gt;I get the following in the log&lt;BR /&gt;&lt;BR /&gt;36 proc freq data=have;&lt;BR /&gt;37 format frequency count. percent pcnt.;&lt;BR /&gt;WARNING: Variable FREQUENCY not found in data set WORK.HAVE.&lt;BR /&gt;WARNING: Variable PERCENT not found in data set WORK.HAVE.&lt;BR /&gt;38 tables area * dz / list nocum ;&lt;BR /&gt;39 run;&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;</description>
      <pubDate>Tue, 30 Mar 2021 18:43:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730176#M227342</guid>
      <dc:creator>Priyamvada07</dc:creator>
      <dc:date>2021-03-30T18:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730185#M227351</link>
      <description>&lt;P&gt;Refer to the documentation for the procedures you are trying to use to see what options they support.&lt;/P&gt;
&lt;P&gt;For PROC FREQ just send the counts to a dataset and then print the dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
  tables area * dz / noprint out=counts;
run;
proc print data=counts;
  format count fcount. percent pcnt. ;
run;.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Mar 2021 19:08:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730185#M227351</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-30T19:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730324#M227400</link>
      <description>I am using the following updated code for proc tabulate. Is there a way to format 'n' and 'pctn' and at the same time rename them to 'Frequency' and 'Percent', respectively?&lt;BR /&gt;&lt;BR /&gt;proc format;&lt;BR /&gt;picture count (round)&lt;BR /&gt;                0-4 = '    &amp;lt;5' (NOEDIT);&lt;BR /&gt;picture pcnt (round)&lt;BR /&gt;                  0 =   '  -   '&lt;BR /&gt;                    other =   '009.9%';&lt;BR /&gt;&lt;BR /&gt;proc tabulate data=have;&lt;BR /&gt;   class area;&lt;BR /&gt;   tables area=' ' all='Total',&lt;BR /&gt;		 n='Frequency' pctn='Percent'&lt;BR /&gt;          /box=area;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;I have tried using the following but its not working&lt;BR /&gt;proc tabulate data=have;&lt;BR /&gt;   class area;&lt;BR /&gt;   tables area=' ' all='Total',&lt;BR /&gt;&lt;BR /&gt;		 ({n*f=count.}='Frequency') ({pctn*f=pcnt.}='Percent')&lt;BR /&gt;          /box=area;&lt;BR /&gt;run;</description>
      <pubDate>Wed, 31 Mar 2021 08:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730324#M227400</guid>
      <dc:creator>Priyamvada07</dc:creator>
      <dc:date>2021-03-31T08:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730328#M227404</link>
      <description>&lt;P&gt;Yes, it is possible. Change proc tabulate line to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;n='Frequency'*f=count.   pctn='Percent'*f=fpcnt. 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Mar 2021 08:20:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730328#M227404</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-03-31T08:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc format for columns in the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730330#M227406</link>
      <description>Worked perfectly! Thank you.</description>
      <pubDate>Wed, 31 Mar 2021 08:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-proc-format-for-columns-in-the-output/m-p/730330#M227406</guid>
      <dc:creator>Priyamvada07</dc:creator>
      <dc:date>2021-03-31T08:27:15Z</dc:date>
    </item>
  </channel>
</rss>

