<?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: Cumulative Percentage within a formatted variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168701#M301096</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;input bin $ prob;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;a .2&lt;/P&gt;&lt;P&gt;a .3&lt;/P&gt;&lt;P&gt;a .6&lt;/P&gt;&lt;P&gt;a .8&lt;/P&gt;&lt;P&gt;b .5&lt;/P&gt;&lt;P&gt;b .6&lt;/P&gt;&lt;P&gt;b .7&lt;/P&gt;&lt;P&gt;b .8&lt;/P&gt;&lt;P&gt;c .1&lt;/P&gt;&lt;P&gt;c .4&lt;/P&gt;&lt;P&gt;c .5&lt;/P&gt;&lt;P&gt;c .7&lt;/P&gt;&lt;P&gt;c .8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.bin);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by bin;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.bin then no=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; no + 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.bin);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by bin;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cum_per = sum(cum_per, (prob / no));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Nov 2014 00:31:55 GMT</pubDate>
    <dc:creator>amats</dc:creator>
    <dc:date>2014-11-13T00:31:55Z</dc:date>
    <item>
      <title>Cumulative Percentage within a formatted variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168698#M301093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello forum,&lt;/P&gt;&lt;P&gt;I am trying to calculate cumulative percent for the variable prob for each of the bin level.&lt;/P&gt;&lt;P&gt;so for bin = 'a' with 4 counts, the cum % should be&lt;/P&gt;&lt;P&gt;0.2/4&lt;/P&gt;&lt;P&gt;(0.2+0.3)/4&lt;/P&gt;&lt;P&gt;and so on .. for each of the bin levels.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;input bin $ prob;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;a .2&lt;/P&gt;&lt;P&gt;a .3&lt;/P&gt;&lt;P&gt;a .6&lt;/P&gt;&lt;P&gt;a .8&lt;/P&gt;&lt;P&gt;b .5&lt;/P&gt;&lt;P&gt;b .6&lt;/P&gt;&lt;P&gt;b .7&lt;/P&gt;&lt;P&gt;b .8&lt;/P&gt;&lt;P&gt;c .1&lt;/P&gt;&lt;P&gt;c .4&lt;/P&gt;&lt;P&gt;c .5&lt;/P&gt;&lt;P&gt;c .7&lt;/P&gt;&lt;P&gt;c .8&lt;/P&gt;&lt;P&gt;.... ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what I would like to see is ..&lt;/P&gt;&lt;P&gt;bin&amp;nbsp; prob&amp;nbsp; cum_per&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;a&amp;nbsp;&amp;nbsp;&amp;nbsp; .2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.05&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;a&amp;nbsp;&amp;nbsp;&amp;nbsp; .3&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.125&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;a&amp;nbsp;&amp;nbsp;&amp;nbsp; .6&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.275&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;a&amp;nbsp;&amp;nbsp;&amp;nbsp; .8&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.475&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;b&amp;nbsp;&amp;nbsp;&amp;nbsp; .5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.125&lt;/P&gt;&lt;P&gt;b&amp;nbsp;&amp;nbsp;&amp;nbsp; .6&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.275&lt;/P&gt;&lt;P&gt;b&amp;nbsp;&amp;nbsp;&amp;nbsp; .7&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.45&lt;/P&gt;&lt;P&gt;b&amp;nbsp;&amp;nbsp;&amp;nbsp; .8&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.65&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;c&amp;nbsp;&amp;nbsp;&amp;nbsp; .1&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.02&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;c&amp;nbsp;&amp;nbsp;&amp;nbsp; .4&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.08&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;c&amp;nbsp;&amp;nbsp;&amp;nbsp; .5&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;c&amp;nbsp;&amp;nbsp;&amp;nbsp; .7&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.14&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;c&amp;nbsp;&amp;nbsp;&amp;nbsp; .8&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.16&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for you help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 21:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168698#M301093</guid>
      <dc:creator>aditip</dc:creator>
      <dc:date>2014-11-12T21:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Percentage within a formatted variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168699#M301094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Inelegant solution, but it works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; test;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;input&lt;/SPAN&gt; bin $ prob;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;cards&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;a .2&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;a .3&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;a .6&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;a .8&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;b .5&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;b .6&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;b .7&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;b .8&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;c .1&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;c .4&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;c .5&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;c .7&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;c .8&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #009193;"&gt;&lt;STRONG&gt;....&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; &lt;/SPAN&gt;create&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;table&lt;SPAN style="color: #000000;"&gt; temp &lt;/SPAN&gt;as&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&amp;nbsp; &lt;SPAN style="color: #0433ff;"&gt;select&lt;/SPAN&gt; a.bin, a.prob, count(bin) &lt;SPAN style="color: #0433ff;"&gt;as&lt;/SPAN&gt; tot&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&amp;nbsp; &lt;SPAN style="color: #0433ff;"&gt;from&lt;/SPAN&gt; test a&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; &lt;/SPAN&gt;group&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;by&lt;SPAN style="color: #000000;"&gt; bin&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&amp;nbsp; &lt;SPAN style="color: #0433ff;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="color: #0433ff;"&gt;by&lt;/SPAN&gt; bin, prob;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; want;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;set&lt;/SPAN&gt; temp;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;retain&lt;/SPAN&gt; cum_prob;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;by&lt;/SPAN&gt; bin;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;if&lt;/SPAN&gt; first.bin &lt;SPAN style="color: #0433ff;"&gt;then&lt;/SPAN&gt; cum_prob=prob/tot;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;else&lt;/SPAN&gt; cum_prob=cum_prob+(prob/tot);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 22:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168699#M301094</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-12T22:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Percentage within a formatted variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168700#M301095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test;&lt;BR /&gt;input bin $ prob;&lt;BR /&gt;cards;&lt;BR /&gt;a .2&lt;BR /&gt;a .3&lt;BR /&gt;a .6&lt;BR /&gt;a .8&lt;BR /&gt;b .5&lt;BR /&gt;b .6&lt;BR /&gt;b .7&lt;BR /&gt;b .8&lt;BR /&gt;c .1&lt;BR /&gt;c .4&lt;BR /&gt;c .5&lt;BR /&gt;c .7&lt;BR /&gt;c .8&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set test;&lt;BR /&gt;by bin;&lt;BR /&gt;if first.bin then cumsum=0;&lt;BR /&gt;cumsum+prob;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table need as&lt;BR /&gt;select bin,prob,cumsum/count(bin) as cum_per from want&lt;BR /&gt;group by bin&lt;BR /&gt;order by bin,prob;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 22:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168700#M301095</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-11-12T22:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Percentage within a formatted variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168701#M301096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;input bin $ prob;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;a .2&lt;/P&gt;&lt;P&gt;a .3&lt;/P&gt;&lt;P&gt;a .6&lt;/P&gt;&lt;P&gt;a .8&lt;/P&gt;&lt;P&gt;b .5&lt;/P&gt;&lt;P&gt;b .6&lt;/P&gt;&lt;P&gt;b .7&lt;/P&gt;&lt;P&gt;b .8&lt;/P&gt;&lt;P&gt;c .1&lt;/P&gt;&lt;P&gt;c .4&lt;/P&gt;&lt;P&gt;c .5&lt;/P&gt;&lt;P&gt;c .7&lt;/P&gt;&lt;P&gt;c .8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.bin);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by bin;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.bin then no=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; no + 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until (last.bin);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by bin;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cum_per = sum(cum_per, (prob / no));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 00:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168701#M301096</guid>
      <dc:creator>amats</dc:creator>
      <dc:date>2014-11-13T00:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Percentage within a formatted variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168702#M301097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A SQL approach (warning: not for the best efficiency):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; bin $ prob;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;a .2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;a .3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;a .6&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;a .8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;b .5&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;b .6&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;b .7&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;b .8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;c .1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;c .4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;c .5&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;c .7&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;c .8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; *, (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; sum(prob) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; bin=a.bin &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; prob &amp;lt;= a.prob )/count(bin) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; cumsum&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have a&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;group&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; bin&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;order&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; a.bin, a.prob&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 01:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168702#M301097</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-13T01:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Percentage within a formatted variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168703#M301098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi another simple solution :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SORT DATA=HAVE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY BIN;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;ODS LISTING CLOSE;&lt;/P&gt;&lt;P&gt;PROC TABULATE DATA=HAVE OUT=FREQ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS BIN&amp;nbsp; /&amp;nbsp; ASCENDING;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TABLE BIN;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;ODS LISTING;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;/P&gt;&lt;P&gt;MERGE TEST (IN=I) FREQ (KEEP=BIN N);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY BIN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF I;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETAIN CUM_PROB;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF FIRST.BIN THEN CUM_PROB = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CUM_PROB = CUM_PROB + PROB;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CUMM_PCT = CUM_PROB / N;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 07:27:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168703#M301098</guid>
      <dc:creator>Trancho</dc:creator>
      <dc:date>2014-11-13T07:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative Percentage within a formatted variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168704#M301099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;
data test;
input bin $ prob;
cards;
a .2
a .3
a .6
a .8
b .5
b .6
b .7
b .8
c .1
c .4
c .5
c .7
c .8
;
run;
data want;
n=0;
 do until(last.bin);
&amp;nbsp; set test;
&amp;nbsp; by bin;
&amp;nbsp; n+1;
 end;
sum=0;
 do until(last.bin);
&amp;nbsp; set test;
&amp;nbsp; by bin;
&amp;nbsp; sum+prob;cum_per=sum/n;output;
 end;
drop n sum;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 13:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cumulative-Percentage-within-a-formatted-variable/m-p/168704#M301099</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-13T13:34:03Z</dc:date>
    </item>
  </channel>
</rss>

