<?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: How to assign a percent format to a computed variable in proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-percent-format-to-a-computed-variable-in-proc/m-p/435006#M108015</link>
    <description>&lt;P&gt;Percent formats are tricky in two respects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, they expect to see decimal fractions.&amp;nbsp; So don't multiply by 100.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, they need a wider width than you would imagine.&amp;nbsp; Percent formats insert a blank before and after.&amp;nbsp; So printing 100.00% requires a total of 9 characters.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Feb 2018 18:54:52 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-02-07T18:54:52Z</dc:date>
    <item>
      <title>How to assign a percent format to a computed variable in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-percent-format-to-a-computed-variable-in-proc/m-p/434992#M108007</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report;
column pct_x;
define pct_x / computed width=6 ' % of X';
compute pct_x / length = 5;
pct_x = (num_x/denom_x)*100;
endcomp;
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Whenever I try to assign format statement in either define row or compute row I get 0% as result instead of the actual value.&lt;/P&gt;&lt;P&gt;WIth this code I am getting the right percentages but they do not seem to be formatted (eg 27.53, 4.567). I want to keep only two digits after the decimal point and insert a % sign as well if possible (eg 27.53%, 4.56%)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 18:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-percent-format-to-a-computed-variable-in-proc/m-p/434992#M108007</guid>
      <dc:creator>div44</dc:creator>
      <dc:date>2018-02-07T18:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a percent format to a computed variable in proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-percent-format-to-a-computed-variable-in-proc/m-p/434994#M108008</link>
      <description>&lt;P&gt;We can't run your code if you don't provide sample data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And it's really bad practice to not have a DATA= in your PROCS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc report&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt; data=have nowd;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 18:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-percent-format-to-a-computed-variable-in-proc/m-p/434994#M108008</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-07T18:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign a percent format to a computed variable in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-percent-format-to-a-computed-variable-in-proc/m-p/435006#M108015</link>
      <description>&lt;P&gt;Percent formats are tricky in two respects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, they expect to see decimal fractions.&amp;nbsp; So don't multiply by 100.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, they need a wider width than you would imagine.&amp;nbsp; Percent formats insert a blank before and after.&amp;nbsp; So printing 100.00% requires a total of 9 characters.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 18:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-a-percent-format-to-a-computed-variable-in-proc/m-p/435006#M108015</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-07T18:54:52Z</dc:date>
    </item>
  </channel>
</rss>

