12-12-2016 01:04 PM
In addition ot @chrej5am, Keep (and Drop) can be a data set option and used anywhere a dataset is used to restrict the variables used by a procedure. Retain is only valid in a data step.
12-13-2016 03:13 AM
Adding to what @chrej5am said, retain works reliably only with newly created variables. Variables that are already present in the input dataset(s) will be overwritten anytime a new observation is read.