proc import datafile='/home/u35263349/My_Folder/Olympics.xlsx'
out=ds
dbms=xlsx;
run;
data ds1;
set ds;
Total=sum(gold ,silver, bronze);
proc print;
run;
proc rank data=ds1 out=ranking descending ties=dense;
var Total ;
ranks total_by_ranks ;
run;
OLYMPICS OUTPUT;
Team |
Gold |
Silver |
Bronze |
Total |
Total_by_Rank |
Japan |
10 |
3 |
5 |
18 |
3 |
United States of America |
9 |
8 |
8 |
25 |
1 |
People's Republic of China |
9 |
5 |
7 |
21 |
2 |
ROC |
7 |
7 |
4 |
18 |
3 |
Great Britain |
4 |
5 |
4 |
13 |
5 |
Republic of Korea |
3 |
2 |
5 |
10 |
7 |
Australia |
3 |
1 |
5 |
9 |
8 |
Canada |
2 |
3 |
3 |
8 |
9 |
France |
2 |
2 |
3 |
7 |
10 |
Germany |
2 |
0 |
3 |
5 |
12 |
Kosovo |
2 |
0 |
0 |
2 |
22 |
Italy |
1 |
5 |
6 |
12 |
6 |
Chinese Taipei |
1 |
2 |
3 |
6 |
11 |
Brazil |
1 |
2 |
2 |
5 |
12 |
Switzerland |
1 |
2 |
2 |
5 |
12 |
Slovenia |
1 |
1 |
1 |
3 |
15 |
Serbia |
1 |
1 |
1 |
3 |
15 |
Hungary |
1 |
1 |
0 |
2 |
22 |
Tunisia |
1 |
1 |
0 |
2 |
22 |
Austria |
1 |
0 |
1 |
2 |
22 |
Croatia |
1 |
0 |
1 |
2 |
22 |
Estonia |
1 |
0 |
1 |
2 |
22 |
Bermuda |
1 |
0 |
0 |
1 |
36 |
Ecuador |
1 |
0 |
0 |
1 |
36 |
Hong Kong, China |
1 |
0 |
0 |
1 |
36 |
Islamic Republic of Iran |
1 |
0 |
0 |
1 |
36 |
Norway |
1 |
0 |
0 |
1 |
36 |
Philippines |
1 |
0 |
0 |
1 |
36 |
Thailand |
1 |
0 |
0 |
1 |
36 |
Uzbekistan |
1 |
0 |
0 |
1 |
36 |
Netherlands |
0 |
3 |
0 |
3 |
15 |
Spain |
0 |
2 |
1 |
3 |
15 |
Georgia |
0 |
2 |
0 |
2 |
22 |
South Africa |
0 |
2 |
0 |
2 |
22 |
Mongolia |
0 |
1 |
2 |
3 |
15 |
Belgium |
0 |
1 |
1 |
2 |
22 |
Czech Republic |
0 |
1 |
1 |
2 |
22 |
Indonesia |
0 |
1 |
1 |
2 |
22 |
Bulgaria |
0 |
1 |
0 |
1 |
36 |
Colombia |
0 |
1 |
0 |
1 |
36 |
Denmark |
0 |
1 |
0 |
1 |
36 |
India |
0 |
1 |
0 |
1 |
36 |
Jordan |
0 |
1 |
0 |
1 |
36 |
North Macedonia |
0 |
1 |
0 |
1 |
36 |
Romania |
0 |
1 |
0 |
1 |
36 |
Turkmenistan |
0 |
1 |
0 |
1 |
36 |
Kazakhstan |
0 |
0 |
3 |
3 |
15 |
Ukraine |
0 |
0 |
3 |
3 |
15 |
Egypt |
0 |
0 |
2 |
2 |
22 |
Mexico |
0 |
0 |
2 |
2 |
22 |
Turkey |
0 |
0 |
2 |
2 |
22 |
Côte d'Ivoire |
0 |
0 |
1 |
1 |
36 |
Cuba |
0 |
0 |
1 |
1 |
36 |
Israel |
0 |
0 |
1 |
1 |
36 |
Kuwait |
0 |
0 |
1 |
1 |
36 |
New Zealand |
0 |
0 |
1 |
1 |
36 |
BUT TOTAL_BY_RANK difference from GREAT Britain
please correct where i was wrong
MYCODE_OUTPUT
Japan |
10 |
3 |
5 |
18 |
3 |
United States of America |
9 |
8 |
8 |
25 |
1 |
People's Republic of China |
9 |
5 |
7 |
21 |
2 |
ROC |
7 |
7 |
4 |
18 |
3 |
Great Britain |
4 |
5 |
4 |
13 |
4 |
Republic of Korea |
3 |
2 |
5 |
10 |
6 |
Australia |
3 |
1 |
5 |
9 |
7 |
Canada |
2 |
3 |
3 |
8 |
8 |
France |
2 |
2 |
3 |
7 |
9 |
Germany |
2 |
0 |
3 |
5 |
11 |
Kosovo |
2 |
0 |
0 |
2 |
13 |
Italy |
1 |
5 |
6 |
12 |
5 |
Chinese Taipei |
1 |
2 |
3 |
6 |
10 |
Brazil |
1 |
2 |
2 |
5 |
11 |
Switzerland |
1 |
2 |
2 |
5 |
11 |
Slovenia |
1 |
1 |
1 |
3 |
12 |
Serbia |
1 |
1 |
1 |
3 |
12 |
Hungary |
1 |
1 |
0 |
2 |
13 |
Tunisia |
1 |
1 |
0 |
2 |
13 |
Austria |
1 |
0 |
1 |
2 |
13 |
Croatia |
1 |
0 |
1 |
2 |
13 |
Estonia |
1 |
0 |
1 |
2 |
13 |
Bermuda |
1 |
0 |
0 |
1 |
14 |
Ecuador |
1 |
0 |
0 |
1 |
14 |
Hong Kong, China |
1 |
0 |
0 |
1 |
14 |
Islamic Republic of Iran |
1 |
0 |
0 |
1 |
14 |
Norway |
1 |
0 |
0 |
1 |
14 |
Philippines |
1 |
0 |
0 |
1 |
14 |
Thailand |
1 |
0 |
0 |
1 |
14 |
Uzbekistan |
1 |
0 |
0 |
1 |
14 |
Netherlands |
0 |
3 |
0 |
3 |
12 |
Spain |
0 |
2 |
1 |
3 |
12 |
Georgia |
0 |
2 |
0 |
2 |
13 |
South Africa |
0 |
2 |
0 |
2 |
13 |
Mongolia |
0 |
1 |
2 |
3 |
12 |
Belgium |
0 |
1 |
1 |
2 |
13 |
Czech Republic |
0 |
1 |
1 |
2 |
13 |
Indonesia |
0 |
1 |
1 |
2 |
13 |
Bulgaria |
0 |
1 |
0 |
1 |
14 |
Colombia |
0 |
1 |
0 |
1 |
14 |
Denmark |
0 |
1 |
0 |
1 |
14 |
India |
0 |
1 |
0 |
1 |
14 |
Jordan |
0 |
1 |
0 |
1 |
14 |
North Macedonia |
0 |
1 |
0 |
1 |
14 |
Romania |
0 |
1 |
0 |
1 |
14 |
Turkmenistan |
0 |
1 |
0 |
1 |
14 |
Kazakhstan |
0 |
0 |
3 |
3 |
12 |
Ukraine |
0 |
0 |
3 |
3 |
12 |
Egypt |
0 |
0 |
2 |
2 |
13 |
Mexico |
0 |
0 |
2 |
2 |
13 |
Turkey |
0 |
0 |
2 |
2 |
13 |
Côte d'Ivoire |
0 |
0 |
1 |
1 |
14 |
Cuba |
0 |
0 |
1 |
1 |
14 |
Israel |
0 |
0 |
1 |
1 |
14 |
Kuwait |
0 |
0 |
1 |
1 |
14 |
New Zealand |
0 |
0 |
1 |
1 |
14 |