Say I've already sorted set1 and set2 by the variables 'sticks', 'stones', and 'bones' and then i do this:
data merged;
merge set1(in=a) set2(in=b);
by sticks stones bones;
if a and b then output;
*else we don't want to do anything;
run;
Is there an easy way to drop all the variables from set2 in the merged dataset without having to type them all? I keep running into this problem where I have two datasets - both with quite a few variables - and I only want to merge them by a few variables and then only keep the variables from one of the sets.
I usually just use proc sql for something like this, but there are a few situations (more complex than above) where where I think merge is better.
Also, I find it annoying that SAS requires you to "manually" sort datasets before merging them. If it will not let you merge datasets unless they are sorted correctly, why doesn't it just do it for you when you use merge? Thoughts? Maybe there is a way around this I don't know about.