Thanks for all of the responses to this question, which provided me with
several interesting ideas. My original question was to try to do this
problem without having to painfully code a big keep or drop statement
since variables are frequently changing.
However, from the responses, I got some good ideas on how to relatively
painlessly automate a keep statement to do what I need.
I especially like the approach, suggested by Frank Poppe, to create a
macro variable in Proc SQL by accessing the DICTIONARY.COLUMNS table
(I've never known about this table before, but it seems to work):
proc sql noprint ;
select trim ( left ( name ) ) into :keeplist separated by " "
from dictionary.columns where libname='yourlib' and memname='first' ;
and use the &keeplist macro variable in a keep= option in a simple merge
>I have two datasets. One contains 100 variables, the other contains
>these 100 plus 900 more.
>I want to update the variables in the first dataset with the data from
>the common variables in the second dataset. But, I don't want the other
>900 in the first dataset.
>In effect, I want to Merge Data1 Data2 to replace all variables in the
>1st with the data from the second.
>Is there a way to do this without coding a big drop statement?