update to SAS if conditions
removed some extraneous working out
updated logic statements to fix a bug

still has an issue with variables needed to be declared first.
Fix #8