How to open SSH socks proxy at startup?
You need to pass the arguments to the ssh command you are running, not to some variables:

ip=aa.bb.cc.dd   #replace with your unix server's ip
username=yyyyyyyyyy #your ssh username
password=xxxxxxxxxxxxxxxxx #your ssh password
command="ssh -D 2002"     #what do you want to do with remote server
arguments=-Cq     #arguments for your command
expect -c 'spawn $command $arguments $username@$ip ; expect password ; send "$password\n" ; interact'