Use IF when you need to filter based on new or transformed variables. Use WHERE when filtering on existing dataset variables, and in PROC steps, for better efficiency. note: With IF, this upcase() runs before filtering, so lowercase “a” and “b” are converted, then kept. With WHERE, the condition is evaluated before upcase(). Since it checks the original values, lowercase “a” or “b” will not match and get dropped. That's why you get different obs number with where and if. incase of missing data- data results.output36; set cleandata36; if Kilograms = '.' or 40>Kilograms or Kilograms>200 then do; if group='A' then Kilograms=79; else Kilograms=89; end; run;
... View more