<?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 Calculating percentage in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70992#M20474</link>
    <description>Hi&lt;BR /&gt;
Can somebody help me with this.&lt;BR /&gt;
Data:&lt;BR /&gt;
Name    operations    next      actiondate&lt;BR /&gt;
Bob            A                sent        11.Jan.2011&lt;BR /&gt;
John           A                sent        11.Jan.2011&lt;BR /&gt;
Bob            A                sent        11.Jan.2011&lt;BR /&gt;
John           A                sent        11.Jan.2011&lt;BR /&gt;
John           A                sent        11.Jan.2011&lt;BR /&gt;
Bob            A                sent        12.Jan.2011&lt;BR /&gt;
John           A                sent        12.Jan.2011&lt;BR /&gt;
Bob            A                sent        12.Jan.2011&lt;BR /&gt;
John           A                sent        12.Jan.2011&lt;BR /&gt;
Bob            B                fail          11.Jan.2011&lt;BR /&gt;
John           B                fail          11.Jan.2011&lt;BR /&gt;
Bob            B                pass        11.Jan.2011&lt;BR /&gt;
John           B                wait        11.Jan.2011&lt;BR /&gt;
John           B                pass          11.Jan.2011&lt;BR /&gt;
Bob            B                fail          12.Jan.2011&lt;BR /&gt;
John           B                fail          12.Jan.2011&lt;BR /&gt;
Bob            B                pass        12.Jan.2011&lt;BR /&gt;
John           B                pass        12.Jan.2011&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
Sas statement:&lt;BR /&gt;
proc tabulate data=SVBZ01A0.user_end_debug;&lt;BR /&gt;
		  keylabel n = ' ';&lt;BR /&gt;
	        class name  operations next actiondate;&lt;BR /&gt;
    		  table name='' * operations='' * next='', actiondate='' all='Total'&lt;BR /&gt;
&lt;BR /&gt;
	/ misstext='0';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Result is table:&lt;BR /&gt;
First column name; second is split into two rows operations A and B; Third: A is always sent and B is split into fail/pass/wait; all by date&lt;BR /&gt;
&lt;BR /&gt;
What I want is to make new column percentage for fail/pass/wait of SENT for every day:&lt;BR /&gt;
&lt;BR /&gt;
Bob sent(A) 2 pc 11.Jan.2011 one is fail one is pass(B). In new colum should be fail 50% and pass 50% &lt;BR /&gt;
&lt;BR /&gt;
John sent(A) 3 pc 11.Jan.2011 one is fail,one is pass and one is wait(B) In new colum should be fail 33,3%, pass 33,3% and wait 33,3% &lt;BR /&gt;
&lt;BR /&gt;
Thak you in advance.</description>
    <pubDate>Thu, 10 Feb 2011 08:58:08 GMT</pubDate>
    <dc:creator>bob021</dc:creator>
    <dc:date>2011-02-10T08:58:08Z</dc:date>
    <item>
      <title>Calculating percentage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70992#M20474</link>
      <description>Hi&lt;BR /&gt;
Can somebody help me with this.&lt;BR /&gt;
Data:&lt;BR /&gt;
Name    operations    next      actiondate&lt;BR /&gt;
Bob            A                sent        11.Jan.2011&lt;BR /&gt;
John           A                sent        11.Jan.2011&lt;BR /&gt;
Bob            A                sent        11.Jan.2011&lt;BR /&gt;
John           A                sent        11.Jan.2011&lt;BR /&gt;
John           A                sent        11.Jan.2011&lt;BR /&gt;
Bob            A                sent        12.Jan.2011&lt;BR /&gt;
John           A                sent        12.Jan.2011&lt;BR /&gt;
Bob            A                sent        12.Jan.2011&lt;BR /&gt;
John           A                sent        12.Jan.2011&lt;BR /&gt;
Bob            B                fail          11.Jan.2011&lt;BR /&gt;
John           B                fail          11.Jan.2011&lt;BR /&gt;
Bob            B                pass        11.Jan.2011&lt;BR /&gt;
John           B                wait        11.Jan.2011&lt;BR /&gt;
John           B                pass          11.Jan.2011&lt;BR /&gt;
Bob            B                fail          12.Jan.2011&lt;BR /&gt;
John           B                fail          12.Jan.2011&lt;BR /&gt;
Bob            B                pass        12.Jan.2011&lt;BR /&gt;
John           B                pass        12.Jan.2011&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
Sas statement:&lt;BR /&gt;
proc tabulate data=SVBZ01A0.user_end_debug;&lt;BR /&gt;
		  keylabel n = ' ';&lt;BR /&gt;
	        class name  operations next actiondate;&lt;BR /&gt;
    		  table name='' * operations='' * next='', actiondate='' all='Total'&lt;BR /&gt;
&lt;BR /&gt;
	/ misstext='0';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Result is table:&lt;BR /&gt;
First column name; second is split into two rows operations A and B; Third: A is always sent and B is split into fail/pass/wait; all by date&lt;BR /&gt;
&lt;BR /&gt;
What I want is to make new column percentage for fail/pass/wait of SENT for every day:&lt;BR /&gt;
&lt;BR /&gt;
Bob sent(A) 2 pc 11.Jan.2011 one is fail one is pass(B). In new colum should be fail 50% and pass 50% &lt;BR /&gt;
&lt;BR /&gt;
John sent(A) 3 pc 11.Jan.2011 one is fail,one is pass and one is wait(B) In new colum should be fail 33,3%, pass 33,3% and wait 33,3% &lt;BR /&gt;
&lt;BR /&gt;
Thak you in advance.</description>
      <pubDate>Thu, 10 Feb 2011 08:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70992#M20474</guid>
      <dc:creator>bob021</dc:creator>
      <dc:date>2011-02-10T08:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70993#M20475</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
&lt;P&gt; From your details I understand that Sum of B (fail, pass, wait) equal A (sent).&lt;BR /&gt;
if my assumption is correct then a little rearrangement of your tabulate may be more appropriate:&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data x;&lt;BR /&gt;
input Name $ operations $ next $ actiondate date11.;&lt;BR /&gt;
format actiondate date7.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
Bob A sent 11.Jan.2011&lt;BR /&gt;
John A sent 11.Jan.2011&lt;BR /&gt;
Bob A sent 11.Jan.2011&lt;BR /&gt;
John A sent 11.Jan.2011&lt;BR /&gt;
John A sent 11.Jan.2011&lt;BR /&gt;
Bob A sent 12.Jan.2011&lt;BR /&gt;
John A sent 12.Jan.2011&lt;BR /&gt;
Bob A sent 12.Jan.2011&lt;BR /&gt;
John A sent 12.Jan.2011&lt;BR /&gt;
Bob B fail 11.Jan.2011&lt;BR /&gt;
John B fail 11.Jan.2011&lt;BR /&gt;
Bob B pass 11.Jan.2011&lt;BR /&gt;
John B wait 11.Jan.2011&lt;BR /&gt;
John B pass 11.Jan.2011&lt;BR /&gt;
Bob B fail 12.Jan.2011&lt;BR /&gt;
John B fail 12.Jan.2011&lt;BR /&gt;
Bob B pass 12.Jan.2011&lt;BR /&gt;
John B pass 12.Jan.2011&lt;BR /&gt;
;&lt;BR /&gt;
proc tabulate data=x format=8.1;&lt;BR /&gt;
keylabel n = 'Total';&lt;BR /&gt;
&lt;BR /&gt;
class name next operations  actiondate;&lt;BR /&gt;
&lt;BR /&gt;
table name=''* actiondate='', &lt;BR /&gt;
(next=''*rowpctn='Percent') all='Sent'*format=5.*{style={color=red fontweight=bold}}&lt;BR /&gt;
&lt;BR /&gt;
/ misstext='0' box={label='My Table represents...' Style={backgroundcolor=yellow}} ;&lt;BR /&gt;
&lt;BR /&gt;
where next ne 'sent';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;P&gt;Marius&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2011 10:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70993#M20475</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-10T10:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70994#M20476</link>
      <description>Hello Marius &lt;BR /&gt;
Thank you very much working like a charm. &lt;BR /&gt;
Bob</description>
      <pubDate>Thu, 10 Feb 2011 11:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70994#M20476</guid>
      <dc:creator>bob021</dc:creator>
      <dc:date>2011-02-10T11:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70995#M20477</link>
      <description>Hi Marius &lt;BR /&gt;
One more thing about this solution.&lt;BR /&gt;
Is it possible to change place of actiondate and next? I mean to have on left side name next and percent and on top actiondate.&lt;BR /&gt;
Thank you in advance</description>
      <pubDate>Fri, 11 Feb 2011 09:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70995#M20477</guid>
      <dc:creator>bob021</dc:creator>
      <dc:date>2011-02-11T09:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70996#M20478</link>
      <description>hello Bob,&lt;BR /&gt;
&lt;BR /&gt;
here is a soltuion with denominator:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc tabulate data=x format=8.1 ;&lt;BR /&gt;
keylabel n = 'Total';&lt;BR /&gt;
&lt;BR /&gt;
class name next operations  actiondate;&lt;BR /&gt;
&lt;BR /&gt;
table name=''* (next=''*pctn&lt;NEXT&gt;='Percent' all='Sent'*format=5.*{style={color=red fontweight=bold}}), &lt;BR /&gt;
actiondate=''&lt;BR /&gt;
&lt;BR /&gt;
/ misstext='0' box={label='My Table represents...' Style={backgroundcolor=yellow}} ;&lt;BR /&gt;
&lt;BR /&gt;
where next ne 'sent';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Marius&lt;/NEXT&gt;</description>
      <pubDate>Fri, 11 Feb 2011 15:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70996#M20478</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-11T15:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentage</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70997#M20479</link>
      <description>Hello Marius &lt;BR /&gt;
Thank you very much. &lt;BR /&gt;
Bob</description>
      <pubDate>Mon, 14 Feb 2011 08:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-percentage/m-p/70997#M20479</guid>
      <dc:creator>bob021</dc:creator>
      <dc:date>2011-02-14T08:01:43Z</dc:date>
    </item>
  </channel>
</rss>

