Date: Fri, 6 Nov 1998 08:17:23 -0500
Reply-To: "John T. Jones" <jonesj@PHARMARESEARCH.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "John T. Jones" <jonesj@PHARMARESEARCH.COM>
Subject: Re: Merging files
Content-Type: text/plain; charset="us-ascii"
Would the in=<varname> dataset option help?
merge a(in=ina) b(in=inb);
by x1 x2 x3...x(k);
if (ina=1) and (inb=1);
IN= creates a temporary dataset variable that
takes the value of 1 when an observation
comes from the dataset and 0 otherwise.
The by statement controls how the 2 datasets
are put together and the in operators require
that an observation for data third be from
both datasets a and b.
At 12:33 PM 11/5/98 -0800, you wrote:
>I have two SAS datasets that I want to merge. Dataset 1 has
>2524 rows and 86 variables. Dataset 2 has 131 rows and 42
>variables. All 42 variables of dataset 2 are variables
>found in Dataset 1 but none of the rows have matches. I
>want to merge the two files into a 3rd file deleting all
>variables that aren't in both files so that I have one file
>with 2655 rows and 42 variables.
>A straightforward merge does not solve the problem. It
>concatenates the two files but doesn't delete the variables
>found in one file but not in the other. I don't do this
>kind of stuff very often and I'm not finding anything
>terribly helpful in the helpfiles or the manuals I have at
>Any suggestions on how best to proceed?
>Marc "Fearless" Feldesman
>"Yeah, and that's why it's still a mystery to me
>Why some people live like they do
>So many nice things happenin' out there
>They never even seen the clues" Jimmy Buffett