To solve this problem, we need to subtract the number of sheep that died from the total number of sheep the farmer had.

Given information:
- The farmer initially had 17 sheep.
- All but 9 of the sheep died.

Step 1: Find the number of sheep that died.
Total sheep - Sheep that didn't die = Sheep that died
17 - 9 = 8 sheep died

Step 2: Find the number of sheep that are left.
Total sheep - Sheep that died = Sheep that are left
17 - 8 = 9 sheep are left

Therefore, the farmer has 9 sheep left.
