The typical environment variable for socks proxies is SOCKS_SERVER, so: export SOCKS_SERVER=127.0.0.1:8000 in conjunction with ssh -D8000
Unfortunately many utilities don't support SOCKS or have non-standard flags, so you would need a wrapping program like tsocks to force TCP through your proxy.