<?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: Program an Elo rating for sports teams in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185214#M962</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I developed other solution and I got the same result gotten by Xia-Keshan:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;It can be&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;easily&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;generalized includying more teams in the Array and updating the do's.&amp;nbsp; I assume a null value of winner when the result is a draw:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;data games;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input date date9. team1 $ team2 $ winner $ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;01jan2014 Team_A Team_B Team_A&lt;/P&gt;&lt;P&gt;05jan2014 Team_B Team_C Team_B&lt;/P&gt;&lt;P&gt;06jan2014 Team_C Team_A &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data winn_loss(drop=team:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set games;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if winner = ' ' then do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; winner=team1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; losser=team1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if winner = team1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; losser=team2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; winner=team2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; losser=team1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want(drop=i: pot:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set winn_loss;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array team[3] Team_A Team_B Team_C (3*1000);&lt;/P&gt;&lt;P&gt;&amp;nbsp; i_winn=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; i_loss=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 3 while (i_winn=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if vinarrayx(winner) and vname(team&lt;I&gt;)=winner then i_winn=i;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 3 while (i_loss=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if vinarrayx(losser) and vname(team&lt;I&gt;)=losser then i_loss=i;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; pot_win=round(team[i_winn]*0.05);&lt;/P&gt;&lt;P&gt;&amp;nbsp; pot_los=round(team[i_loss]*0.05);&lt;/P&gt;&lt;P&gt;&amp;nbsp; team[i_winn]=team[i_winn]+pot_los;&lt;/P&gt;&lt;P&gt;&amp;nbsp; team[i_loss]=team[i_loss]-pot_los;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CTorres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Jan 2015 21:01:47 GMT</pubDate>
    <dc:creator>CTorres</dc:creator>
    <dc:date>2015-01-16T21:01:47Z</dc:date>
    <item>
      <title>Program an Elo rating for sports teams</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185212#M960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;I would like to program an "Elo" rating in SAS to rate sports teams. The Elo rating was originally developed to rate chess players. I would like this one to work as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Each team starts off with an initial rating of 1,000 points.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;For each match, each team contributes 5% of their current rating to the "Pot"&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;The winning team collects the pot and that amount is added to the it's new (post match) rating&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;The losing team does not take anything from the pot and their rating will decrease by how much they contributed&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;If there is a tie, the pot will be split equally between to the two teams.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Example&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Lets say we have 3 teams, Team A, B and C&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;First match is A v B. Each team's initial rating is 1,000 and they contribute 5% of that (50 points) each to the pot&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Team A wins and collects the pot. Their new rating is 1,050. Team B lose so take nothing, just lose the 50 points they contributed so their new rating is 950.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Next match is B v C. B's pre match rating is 950 and they contribute 5% of that to the pot (48). It's team C's first match so their pre match rating is 1,000 and they contribute 5% (50) to the pot.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Team B win and collect the pot so their new rating is 1,048. Team C lose so their rating decreases by the 50 they contributed. Their post match rating is 950.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;So at this point the team rating would read as follows:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,050&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,048&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 950&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;See below the variables in my dataset (along with first few lines of sample data)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Date Team 1 Team 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Winner&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;01jan2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team A Team B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;05jan2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team B Team C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;cxkev182&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 19:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185212#M960</guid>
      <dc:creator>cxkev182</dc:creator>
      <dc:date>2015-01-15T19:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Program an Elo rating for sports teams</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185213#M961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand.&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;"The first match is A v B. Both of their pre match rating is 1,000 so they each contribute 5% of their rating to the pot (50 points each.)&lt;/P&gt;&lt;P&gt;Team A wins so their rating increases to 1,050. Team B loses so their rating decreases to 950."&lt;/P&gt;&lt;P&gt;TeamA would be 1,050( take 50 from TeamB). TeamB would be 950(lost 50).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;"The next match is B v C. B's current rating is 950 and they contribute 5% of that (48 points) to the point. This is C's first match so their rating is 1,000. They contribute 5% (50 points) to the pot."&lt;/P&gt;&lt;P&gt;TeamB would be 950+50(take 50 from TeamC) ??&amp;nbsp; TeamC would be 950(lost 50). ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why TeamB would be Team B&amp;nbsp; 950+50+48= 1,048&amp;nbsp; ? That is right ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming the first scenario is right .&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input Date : date9.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;nbsp; Team1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Winner ) (&amp;amp; $);&lt;/P&gt;&lt;P&gt;format date date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;01jan2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team A&lt;/P&gt;&lt;P&gt;05jan2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team B&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; if _n_ eq 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length team $ 80;&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hash h();&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.definekey('team');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.definedata('team','score');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.definedone();&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt; set have end=last;&lt;/P&gt;&lt;P&gt; retain score 1000;&lt;/P&gt;&lt;P&gt; team=team1;h.replace();&lt;/P&gt;&lt;P&gt; team=team2;h.replace();&lt;/P&gt;&lt;P&gt; if last then h.output(dataset:'team');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; if _n_ eq 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if 0 then set team;&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hash h(dataset:'team');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.definekey('team');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.definedata('team','score');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.definedone();&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt; set have end=last;&lt;/P&gt;&lt;P&gt; if winner=team1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.find(key:team2);get=score*0.05;score=score-get; h.replace();&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.find(key:team1);score=score+get;h.replace();&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt; else if winner=team2 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.find(key:team1);get=score*0.05;score=score-get; h.replace();&lt;/P&gt;&lt;P&gt;&amp;nbsp; h.find(key:team2);score=score+get;h.replace();&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt; if last then h.output(dataset:'want');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&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>Fri, 16 Jan 2015 09:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185213#M961</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-16T09:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Program an Elo rating for sports teams</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185214#M962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I developed other solution and I got the same result gotten by Xia-Keshan:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;It can be&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;easily&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;generalized includying more teams in the Array and updating the do's.&amp;nbsp; I assume a null value of winner when the result is a draw:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;data games;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input date date9. team1 $ team2 $ winner $ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;01jan2014 Team_A Team_B Team_A&lt;/P&gt;&lt;P&gt;05jan2014 Team_B Team_C Team_B&lt;/P&gt;&lt;P&gt;06jan2014 Team_C Team_A &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data winn_loss(drop=team:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set games;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if winner = ' ' then do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; winner=team1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; losser=team1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if winner = team1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; losser=team2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; winner=team2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; losser=team1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want(drop=i: pot:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set winn_loss;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array team[3] Team_A Team_B Team_C (3*1000);&lt;/P&gt;&lt;P&gt;&amp;nbsp; i_winn=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; i_loss=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 3 while (i_winn=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if vinarrayx(winner) and vname(team&lt;I&gt;)=winner then i_winn=i;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 3 while (i_loss=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if vinarrayx(losser) and vname(team&lt;I&gt;)=losser then i_loss=i;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; pot_win=round(team[i_winn]*0.05);&lt;/P&gt;&lt;P&gt;&amp;nbsp; pot_los=round(team[i_loss]*0.05);&lt;/P&gt;&lt;P&gt;&amp;nbsp; team[i_winn]=team[i_winn]+pot_los;&lt;/P&gt;&lt;P&gt;&amp;nbsp; team[i_loss]=team[i_loss]-pot_los;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CTorres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2015 21:01:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185214#M962</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2015-01-16T21:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Program an Elo rating for sports teams</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185215#M963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great thanks for your help and apologies for my typo in the original question. I wish I could mark both as correct answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Jan 2015 09:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Program-an-Elo-rating-for-sports-teams/m-p/185215#M963</guid>
      <dc:creator>cxkev182</dc:creator>
      <dc:date>2015-01-17T09:54:09Z</dc:date>
    </item>
  </channel>
</rss>

