Dear Statalist,
This is another question about nested loops (maybe there is another way).
Let's say we have the data of the ranking positions of the past 4 FIFA World Cups. However and unfortunately, some countries have been desquilified and their results in the past tournaments have been taken out. So we need to give the titles (and 2nd and 3rd positions) to the next in the ranking.
Germany, Argentina and Spain have been disqualified and lose their titles, second, and third positions. So they are removed and we want to know how the standings look like after they are taken out (moving the rest of the teams up). For example, the changes for 2006 would be Italy1st, France 2nd and Portugal 3rd (we don't care about 4th, 5th and 6th position changes)
Any ideas? I have been playing around with nested loops but I have not gotten what I want.
This is another question about nested loops (maybe there is another way).
Let's say we have the data of the ranking positions of the past 4 FIFA World Cups. However and unfortunately, some countries have been desquilified and their results in the past tournaments have been taken out. So we need to give the titles (and 2nd and 3rd positions) to the next in the ranking.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year str11 (rank1 rank2 rank3 rank4 rank5 rank6) 2018 "Germany" "Brazil" "Argentina" "Spain" "France" "Sweden" 2014 "Germany" "Argentina" "Netherlands" "Brazil" "Colombia" "Belgium" 2010 "Spain" "Netherlands" "Germany" "Uruguay" "Argentina" "Brasil" 2006 "Italy" "France" "Germany" "Portugal" "Brasil" "Argentina" end
Any ideas? I have been playing around with nested loops but I have not gotten what I want.
Comment