Have you thought of using a proc to clean this up a bit?
Edit: referring to the lines below