In a saucepan over medium heat, combine sugar, milk, and margarine. Bring to a boil, stirring occasionally, then boil for 4 to 5 minutes. Remove from heat and stir in the oats, vanilla, cocoa and coconut. Spoon onto waxed paper and allow to cool for at least an hour. Store in an airtight container.