Date: Wed, 28 May 1997 05:57:51 GMT
Reply-To: DNordlund <dnordlund@AOL.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: DNordlund <dnordlund@AOL.COM>
Organization: AOL http://www.aol.com
Subject: Re: New User needs Comparisons Help
In article <3385A0AA.62EB@scientist.com>, Warren Schlechte
<warren@scientist.com> writes:
>Subject: New User needs Comparisons Help
>From: Warren Schlechte <warren@scientist.com>
>Date: Fri, 23 May 1997 09:50:34 -0400
>
>I know that what I want to do should be easy, but cannot seem to find a
>a way to get SAS to do it. I am very new to SAS, so forgive me if this
>is obvious.
>
>I have two data sets. In each are two variables, one an id_code and one
>a string. I need to go through both data sets and output only those
>records that have either of the two variables different.
>
>An example is shown below to illustrate my needs.
>
>Thanks in advance
>
>Warren Schlechte
>
>EXAMPLE:
>
>data a data b
>
>id_code stringa id_code stringb
>1 a 1 b
>1 b 2 a
>2 a 4 c
>3 a 5 a
>5 c
>
>I want output
>
>data c
>
>id_code stringa stringb
>
>1 a .
>3 a .
>4 . c
>5 c a
>
>
It seems to me that the output for id_code=1 and id_code=5 are
inconsistent. If you allow the record for id_code=1 to be
id_code stringa stringb
1 a b
then something "like" the following code might work.
data newdata;
merge data_a data_b;
by id_code;
if stringa ne stringb;
run;
Good luck,
Dan
|