LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Feb 2004 09:42:21 -0500
Reply-To:     Charles Patridge <charles_s_patridge@PRODIGY.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Charles Patridge <charles_s_patridge@PRODIGY.NET>
Subject:      Re: Comparing/Deleting common records in 2 datasets
Comments: To: Sun Bow <sunbow4u@HOTMAIL.COM>

Dear Sunbow -

Try this - data a; infile cards missover; input id $3. var1 var2 var3 var4 ; cards; 001 458 69 21 35 004 450 25 01 19 005 84 44 27 18 007 14 43 57 69 ;;;; run;

data b ; infile cards missover; input id $3. varx vary varz; cards; 004 118 14 46 005 23 27 14 018 57 19 54 ;;;; run;

proc sort data=a out=a; by id; run; proc sort data=b out=b; by id; run;

data desired; merge a (in=_a_) b (in=_b_); by id; if _a_ and _b_ then delete; /*** comes from both files ***/ if _a_ and not _b_; /*** keep if it only comes from file ***/ drop varx--varz; run;

proc print; run; /*** desired output id var1 var2 var3 var4 001 458 69 21 35 007 14 43 57 69 ***/

HTH, Charles Patridge www.sconsig.com


Back to: Top of message | Previous page | Main SAS-L page