Depends on the test level also.
If IOC level, they can trace 10yrs (According to Milos).
thats only if they take a sample and store it for 10 years. This is the new retrospective testing regime they implemented to counter designer steroids.
Everything else needs to have some form of half life and when they test for it, the levels present are gauged against the rules.
i.e. they test athlete's sample that has been stored from 1999, in 2009 against the newly detected drugs. thats how they can test for 10 years..and even then its still against what that athlete had in them when they took the blood.