cleaned up the code. the loop runs for all the numeric variables but there may still be problems
cleaned up the code