<?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 format the ratio and create percent variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401463#M97406</link>
    <description>&lt;P&gt;format ratio 7.5;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would actually get you 0.12345, not .12345.&amp;nbsp; But eliminating the leading zero is trouble, and not worth the effort.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To create a PERCENT variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;percent = put(ratio, percent9.2);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The width needs to be 9, because the percent formats automatically include a leading and a trailing blank (and you may have to be able to express 100%).&amp;nbsp; Because of the leading blank, you may want to apply this statement as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;percent = left(percent);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that PERCENT will be a character field, not something that you can use to perform math.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2017 17:47:27 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-10-05T17:47:27Z</dc:date>
    <item>
      <title>How to format the ratio and create percent variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401454#M97400</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;I have the following codes.&amp;nbsp; I would like to format the ratio shown as .12345 and create percent variable as 12.35%.&amp;nbsp; Please advice how to do it.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; poverty;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; poverty;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;BelowPoverty=Under50+Under50to99;&lt;/P&gt;
&lt;P&gt;Ratio=belowpoverty/total;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 17:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401454#M97400</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-10-05T17:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the ratio and create percent variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401460#M97403</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format ratio percent8.2; &lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 17:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401460#M97403</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-10-05T17:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the ratio and create percent variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401462#M97405</link>
      <description>&lt;P&gt;Try a FORMAT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0d5oq7e0oia0wn13nsins0x8nmh.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0d5oq7e0oia0wn13nsins0x8nmh.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;List of formats are available here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0p2fmevfgj470n17h4k9f27qjag.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0p2fmevfgj470n17h4k9f27qjag.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 17:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401462#M97405</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-05T17:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the ratio and create percent variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401463#M97406</link>
      <description>&lt;P&gt;format ratio 7.5;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would actually get you 0.12345, not .12345.&amp;nbsp; But eliminating the leading zero is trouble, and not worth the effort.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To create a PERCENT variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;percent = put(ratio, percent9.2);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The width needs to be 9, because the percent formats automatically include a leading and a trailing blank (and you may have to be able to express 100%).&amp;nbsp; Because of the leading blank, you may want to apply this statement as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;percent = left(percent);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that PERCENT will be a character field, not something that you can use to perform math.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 17:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401463#M97406</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-05T17:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the ratio and create percent variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401477#M97409</link>
      <description>&lt;P&gt;Thank you so much for your great help!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 18:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-the-ratio-and-create-percent-variable/m-p/401477#M97409</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-10-05T18:39:21Z</dc:date>
    </item>
  </channel>
</rss>

