<?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: calculate percentage changes in variable values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444337#M111226</link>
    <description>&lt;P&gt;Great! That's what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
    <pubDate>Sat, 10 Mar 2018 02:52:47 GMT</pubDate>
    <dc:creator>sasecn</dc:creator>
    <dc:date>2018-03-10T02:52:47Z</dc:date>
    <item>
      <title>Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444322#M111220</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;I have a data set as below. I want to create a two-table that each cell has a value as percentage of changes in values. E.G. for variable "x1", it has values: a, b, c, d (in exact data, it has more values. so using loop for all values are desired). I want to get the percent of "a" changing to "b", "c", "d", and percent of remaining in "a" (based on the values of variable "x2").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input x1 $1 x2 $1;
cards;
a a
a a
a b
a c
a d
b b
b a
b c
b d
c c
c c
c c
c a
d d
d a
d b
d b
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So my goal is to get a table like:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;a &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d&lt;/P&gt;&lt;P&gt;a &amp;nbsp; 2/5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1/5 &amp;nbsp; &amp;nbsp;1/5 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/5&lt;/P&gt;&lt;P&gt;b &amp;nbsp; 1/4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1/4 &amp;nbsp; &amp;nbsp;1/4 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/4&lt;/P&gt;&lt;P&gt;c &amp;nbsp; 1/4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3/4 &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;d &amp;nbsp; 1/4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2/4 &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1/4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 00:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444322#M111220</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-10T00:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444324#M111221</link>
      <description>&lt;P&gt;Sorry, i think my data code is&amp;nbsp;somehow getting problems, Please use the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input x1 $ x2 $;
   datalines;
a a
a a
a b
a c
a d
b b
b a
b c
b d
c c
c c
c c
c a
d d
d a
d b
d b
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Mar 2018 01:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444324#M111221</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-10T01:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444331#M111225</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input x1 $1. x2 :$1.;
cards;
a a
a a
a b
a c
a d
b b
b a
b c
b d
c c
c c
c c
c a
d d
d a
d b
d b
;
run;


proc sql;
create table t as
select x1,x2, count(x2)	as c
from test
group by x1,x2;
quit;
proc transpose data=t out=want(drop=_name_) ;
by x1;
var c;
id x2;
run;

data final_want;
set want;
array t(*) _numeric_;
k=sum(of t(*));
do _n_=1 to dim(t);
if missing(t(_n_)) then t(_n_)=0;
else t(_n_)=t(_n_)/k*100;
end;
drop k;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Mar 2018 02:03:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444331#M111225</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-10T02:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444337#M111226</link>
      <description>&lt;P&gt;Great! That's what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 02:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444337#M111226</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-10T02:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444339#M111227</link>
      <description>&lt;P&gt;or using proc freq and proc transpose?&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have; 
	tables x1*x2 / noprint nofreq nocol nopercent sparse outpct out=temp(keep=x1 x2 PCT_ROW); 
run;
proc transpose data=temp out=want(drop=_Name_ _Label_); 
	by x1; 
	id x2; 
run;
proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 03:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444339#M111227</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2018-03-10T03:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444340#M111228</link>
      <description>&lt;P&gt;Hello Wong:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works well. Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 03:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444340#M111228</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-10T03:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444342#M111230</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205" target="_self"&gt;novinosrin&lt;/A&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I have a follow up question. When I ran the code on my real data, it gave me an error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;-----&lt;BR /&gt;180&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;The error is right after the code&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
create &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; t as
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; x1&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;x2&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;x2&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;	as c
&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; test
&lt;SPAN class="token keyword"&gt;group&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; x1&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;x2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My data is not sorted.I also got an error later as: Data set MYDATA.T is not sorted in ascending sequence.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does the code only run if the data is sorted?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 03:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444342#M111230</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-10T03:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444343#M111231</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Does the code only run if the data is sorted?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;No, Sql doesn't require for the dataset to be sorted. I am not sure why the code isn't working for your real data. However&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16719"&gt;@Miracle&lt;/a&gt;&amp;nbsp;'s code is rather robust as proc freq takes care of most of the work. I would suggest to try that as opposed to the longer process.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 04:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444343#M111231</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-10T04:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444344#M111232</link>
      <description>&lt;P&gt;Thank you for your reply. You are right that Wong's code works fine. I am also interested in learning sql process. Not sure why the code not working on my real data. But your code also teaches me something I need in the future. Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 04:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444344#M111232</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-10T04:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444345#M111233</link>
      <description>&lt;P&gt;Indeed that's why i am in this forum. The sql logic is too simple and aint a big deal. If it's not a matter of data security in business production environment, i would ask you to share more of your real so that I can debug and test from my side. Obviously, we can't do that against ethics.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 04:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444345#M111233</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-10T04:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444352#M111238</link>
      <description>&lt;P&gt;Well, I cannot share the real data here. It is confidential. But it basically just like the test data. The only two variables needed are locations of a firm who may move to other locations or remain in original place in certain period. Also, it is not sorted. I didn't see anything wrong with the code. Just don't know why I got that error. I also notice that it creates a table "t" in the sql procedure. But the column "c" has only one value which is the number of observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 05:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444352#M111238</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-10T05:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444371#M111244</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input x1 $ x2 $;
cards;
a a
a a
a b
a c
a d
b b
b a
b c
b d
c c
c c
c c
c a
d d
d a
d b
d b
;
run;
proc tabulate data=test;
class x1 x2;
table x1='',x2=''*rowpctn=''/misstext='0';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Mar 2018 10:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444371#M111244</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-10T10:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444573#M111328</link>
      <description>&lt;P&gt;Thanks for your reply. It works. What if I also want the frequency count in the result?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Mar 2018 19:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444573#M111328</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-11T19:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444712#M111376</link>
      <description>&lt;P&gt;OK. Easy for PROC TABULATE .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input x1 $ x2 $;
cards;
a a
a a
a b
a c
a d
b b
b a
b c
b d
c c
c c
c c
c a
d d
d a
d b
d b
;
run;
proc tabulate data=test;
class x1 x2;
table x1='',x2=''*(n='n' rowpctn='rowpctn%')/misstext='0';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Mar 2018 12:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444712#M111376</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-12T12:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444742#M111387</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 13:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444742#M111387</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-12T13:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444837#M111413</link>
      <description>&lt;P&gt;Sorry to bother you again. I have two follow up questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. How to add weight variable to the code? I guess the code always print out the unweighted result of n and rowpctn. I tried to add a weight variable but getting same as unweighted result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. How to modify the table to meet certain conditions? for example, if&amp;nbsp; my result (with rowpctns) looks like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d&lt;/P&gt;&lt;P&gt;a&lt;/P&gt;&lt;P&gt;b&amp;nbsp; &amp;nbsp;&amp;nbsp;10/40&amp;nbsp; &amp;nbsp; 16/40&amp;nbsp; &amp;nbsp; &amp;nbsp; 4/40&amp;nbsp; &amp;nbsp; 10/40&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the row of "b", the cell corresponding to col "c" has count of 4 and rwopctn=4/(10+16+4+10). But for data confidentiality reason, I cannot include that number if my result. The condition is that the cell count cannot be less than 5. I have to recalculate the result (for row "b") as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;b&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;c&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d&lt;/P&gt;&lt;P&gt;b&amp;nbsp; &amp;nbsp;10/(10+16+10)&amp;nbsp; &amp;nbsp; 16/(10+16+10)&amp;nbsp; &amp;nbsp; &amp;nbsp; --&amp;nbsp; &amp;nbsp; &amp;nbsp;10/(10+16+10)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the row "b", the rowpctn will be based on the total number by delete the count from col "c".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure if my question is clear of not. Please let me know if it is not clear to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 16:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/444837#M111413</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-12T16:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/445144#M111518</link>
      <description>&lt;P&gt;Try WEIGHT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input x1 $ x2 $;
cards;
a a
a a
a b
a c
a d
b b
b a
b c
b d
c c
c c
c c
c a
d d
d a
d b
d b
;
run;
proc sql;
create table temp as
select x1,x2,count(*) as m,case when count(*) &amp;lt;=2 /*&amp;lt;--Change it into 5*/ then .
             else count(*) end as weight
 from test
  group by x1,x2;
quit;

proc tabulate data=temp;
class x1 x2;
var m;
table x1='',x2=''*m=''*(sum='n' rowpctsum='rowpctsum%')/misstext='0';
weight weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Mar 2018 12:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/445144#M111518</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-13T12:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage calculation: calculate percentage changes in variable values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/445196#M111530</link>
      <description>&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 15:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Percentage-calculation-calculate-percentage-changes-in-variable/m-p/445196#M111530</guid>
      <dc:creator>sasecn</dc:creator>
      <dc:date>2018-03-13T15:15:56Z</dc:date>
    </item>
  </channel>
</rss>

