|
I received several responses to my initial post. There are some
misunderstanding and my typing errors. So here are some
clarifications.
1. It should be "data file3;", not "data file3". A typo.
2. File 1 is a mail campaign file that has about 1 million records.
The primary key is com4. File 2 is the response file from File 1,
having about 152,000 records. Com4 again is the primary key in File2.
File 2 has another attribute that I need to combine into File 1. So
the merge is performed.
3. What I want is to keep the 1 million some obs from File1 when the
attribute comes into File 3, instead of keep only those with the com4
values matched between File1 and File2. So i ran this
data file3;
merge file1(in=a) file2(in=b);
by com4;
if a;
run;
4. Then in the resulting File 3 I found there are about 150 obs having
values missing in var 1 and var 2. I decide to drop them out of File3.
Given that File 1 has about 255 variables, I tried not to duplicate
another 'big'data set simply to drop the 150 obs. Therefore I tried
this
data file3;
merge file1(in=a) file2(in=b);
by com4;
if a;
if (var1 ne 0) and (var2 ne 0);
run;
5. Then I got about 152,000 obs left in File3. More precisely, I have
(152,000-150) left in File 3. Ms Whitlock's input regarding the
invisible output statement at the end of the steps seems to be
correct, but here I got the result as if I am running
data file3;
merge file1(in=a) file2(in=b);
by com4;
if b;
if (var1 ne 0) and (var2 ne 0);
run;
Given the fact that all the com4 values in File 2 are found in File 1,
this result is also as if I am running
data file3;
merge file1(in=a) file2(in=b);
by com4;
if a and b;
if (var1 ne 0) and (var2 ne 0);
run;
That is how I got the idea the join has been changed to an inner join.
It probably is more like a left outer join has been changed to a right
outer join.
6. I don't understand what
"
if a and (var1 ne 0) and (var2 ne 0) ; "
means. I don't want to pre-screen File 1 for Var1 and Var2. I just
want to drop those (var1 ne 0) and (var2 ne 0) from File3.
Thank you for all your quick response, as always.
Paula D
|