<?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: percentage calculation in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/percentage-calculation/m-p/410520#M26327</link>
    <description>&lt;P&gt;Assuming you have your input data in a data set (and it's not really good practice to hold the total in with the disaggregate) then load the total in a macro variable and a simple data step will do the rest like so&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	length particulars $30;
	infile datalines dlm=",";
	input particulars count;
	datalines;
Success Transaction,100
Failure Transaction,20
Total Transaction,120
;
run;

proc sql noprint;
	select count into :numtot
	from have
	where particulars="Total Transaction";
quit;

data want;
	set have(where=(particulars ne "Total Transaction"));
	percentage=(count/&amp;amp;numtot)*100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Nov 2017 10:24:49 GMT</pubDate>
    <dc:creator>ChrisBrooks</dc:creator>
    <dc:date>2017-11-04T10:24:49Z</dc:date>
    <item>
      <title>percentage calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/percentage-calculation/m-p/410516#M26325</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a report with has&lt;/P&gt;&lt;P&gt;particulars &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;count&lt;/P&gt;&lt;P&gt;Success Transaction 100&lt;/P&gt;&lt;P&gt;Failure Transaction &amp;nbsp; &amp;nbsp;20&lt;/P&gt;&lt;P&gt;Total Transaction &amp;nbsp; &amp;nbsp;120&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Requirement is i need a new column Percentage.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;particulars &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count &amp;nbsp;percentage&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sucess Transaction 100 &amp;nbsp; &amp;nbsp;83%&lt;/P&gt;&lt;P&gt;Failure Transaction 20 &amp;nbsp; &amp;nbsp; &amp;nbsp; 16%&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 07:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/percentage-calculation/m-p/410516#M26325</guid>
      <dc:creator>nr1</dc:creator>
      <dc:date>2017-11-04T07:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: percentage calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/percentage-calculation/m-p/410520#M26327</link>
      <description>&lt;P&gt;Assuming you have your input data in a data set (and it's not really good practice to hold the total in with the disaggregate) then load the total in a macro variable and a simple data step will do the rest like so&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	length particulars $30;
	infile datalines dlm=",";
	input particulars count;
	datalines;
Success Transaction,100
Failure Transaction,20
Total Transaction,120
;
run;

proc sql noprint;
	select count into :numtot
	from have
	where particulars="Total Transaction";
quit;

data want;
	set have(where=(particulars ne "Total Transaction"));
	percentage=(count/&amp;amp;numtot)*100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 10:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/percentage-calculation/m-p/410520#M26327</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-11-04T10:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: percentage calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/percentage-calculation/m-p/410551#M26336</link>
      <description>&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;where particulars ne 'Total Transaction';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;table particulars / out=want outpercent;&lt;/P&gt;
&lt;P&gt;freq count ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 15:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/percentage-calculation/m-p/410551#M26336</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-04T15:55:58Z</dc:date>
    </item>
  </channel>
</rss>

