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 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 22 Feb 2000 23:58:38 GMT
Reply-To:     robin_rl@MY-DEJA.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         robin_rl@MY-DEJA.COM
Organization: Deja.com - Before you buy.
Subject:      Re: Detecting Additional Obs After Merge

Ogbonnaya, > After the merge, my new dataset (dataset3) has 1495588 obs which is 4 > more than I expected. The 4 extra records should be in Dataset2 but not in Dataset1. See the following example:

data a; input x y $; cards; 1 a 2 b 3 c 4 d 5 e ;

data b; input x z $; cards; 1 aa 2 bb 3 cc 6 ff ;

/* if a record is not in dataset a, it gets put into dataset unexpect*/ /* dataset c contains all the records resulting from the merge, the "unexpected" records have remarks */ data c unexpect; merge a (in=ina) b; by x; if ina=0 then do; output unexpect; remarks='not from dataset a'; end; output c; run;

proc print data=unexpect; run;

OBS X Y Z 1 6 ff

proc print data=c; run;

OBS X Y Z REMARKS 1 1 a aa 2 2 b bb 3 3 c cc 4 4 d 5 5 e 6 6 ff not from dataset a

-Robin

In article <Pine.OSF.3.96.1000222130849.4871B-100000@spectre.ag.uiuc.edu>, "O J Nwoha (217)333-3209" <nwohaj@spectre.ag.uiuc.edu> wrote: > Dear SASlers; > > I merged two data sets by a unique id. Dataset1 has 1495584 and dataset2 > has 18988 obs. After the merge, my new dataset (dataset3) has 1495588 > obs which is 4 more than I expected. How can I detect the 4 obs that are > in dataset3, but not in dataset1? > > Ogbonnaya John Nwoha > http://www.ag.uiuc.edu/~nwohaj/ > > Research Assistant, AgMas & FARM.DOC Projects > http://www.aces.uiuc.edu/~agmas/ > http://web.aces.uiuc.edu/farmdoc/ > > Phone: (217)333-3209 > >

Sent via Deja.com http://www.deja.com/ Before you buy.


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