You can use the "in" proc sql clause to copy the column of variable names from the "vars" dataset into a macro variable, which is then passed to the drop= statement in the data step. See below:
proc sql noprint; select <name_of_column> into: vars_to_drop separated by " " from var; quit; data data; set data (drop= &vars_to_drop); run;
source share