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 (December 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 3 Dec 2004 16:30:15 -0500
Reply-To:     "Fehd, Ronald J." <RJF2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J." <RJF2@CDC.GOV>
Subject:      Re: proc compare - outdif, outbase, outcomp
Content-Type: text/plain; charset="us-ascii"

you probably want to reduce both datasets to the same set of IDs. before you do the comparison

%Let Ids = Site LogNum; %Let id1 = %scan(&Ids,1); %Let id2 = %scan(&Ids,3; DATA BOTH; do until(EndoFile); merge out1.scrn_fax_verif_sort (in = Have1 keep = &Ids.) out1.scrn_verif_sort (in = Have2 keep = &Ids.); by &Ids.; if first.&Id2 and last.&Id2 and Have1 and Have2 then output; end;stop;run;

note the above will remove duplicates.

data Base; merge Both (in = CommonToBoth) out1 ... by &Ids.; if CommonToBoth then output;

and same for Data

then Compare

> From: Chris Abbate > I am using proc compare to output the value differences > between 2 exact datasets: > > proc compare > base = out1.scrn_fax_verif_sort > compare = out1.scrn_verif_sort > out = out1.differences > outnoequal outbase outcompare outdif noprint; > id site lognum; > run; > > I only want to see value differences for matching records... > but in addition to showing the differences for matching > records (where the ID variables SITE and LOGNUM match), this > also shows the records in Base that are not in Compare and > the records in Compare that are not in Base. > > Is there a way to show the Base, Compare and Difference lines > for matching records (where the ID variables SITE and LOGNUM > match), but NOT show the records that are in Base but not > Compare and are in Compare but not Base? > > (I tried to remove outbase and outcompare from the above > program, but then the output only shows the Difference > (_TYPE_ = DIFF) line.

%ARRAY: construction and usage of arrays of macro variables http://www2.sas.com/proceedings/sugi29/070-29.pdf

Posters 170 %COMPARWS %COMPARWS: Compare with summary: a macro using proc COMPARE to write a file of differences to edit and use for updates http://www2.sas.com/proceedings/sugi23/Posters/p170.pdf

Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov


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