| Date: | Sat, 12 Feb 2011 14:32:59 -1000 |
| Reply-To: | John.V.Parker@KP.ORG |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | John Parker <John.V.Parker@KP.ORG> |
| Subject: | Re: Merging Datasets |
|
| In-Reply-To: | <201102130024.p1CBl9XA019149@waikiki.cc.uga.edu> |
| Content-Type: | text/plain; charset="US-ASCII" |
|---|
Art,
I just restarted my pc as it hasn't been restarted in over a week and my
aps that are running is like watching paint dry.
I'll rerun and send my issues to the list, thanks,
John
"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> wrote on 02/12/2011 02:24:41
PM:
> John,
>
> You will have to show the list the code you attempted in order for
anyone to
> know what to suggest.
>
> Art
> -------
> On Sat, 12 Feb 2011 14:19:03 -1000, John Parker <John.V.Parker@KP.ORG>
> wrote:
>
> >Art and All,
> >
> >I have just finished trying all of the suggestions. Nothing is
working.
> >
> >Either it doesn't work or I get my original data set values but not the
> >2nd data set.
> >
> >The variable names in both data sets are the same. The variables names
> >have the same type, lenght, etc.
> >
> >The only difference is that one data set has new lab tests that I want
to
> >include with the original data.
> >
> >If this makes a difference, one data set has formats assigned the 2nd
> >doesn't.
> >
> >John
> >
> >
> >
> >
> >"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> wrote on 02/12/2011
01:41:55
> >PM:
> >
> >> John,
> >>
> >> No! If you are trying to merge according to by variables, you have
to
> >use a
> >> by statement. However, a datastep merge is not particularly well
suited
> >for
> >> a many-to-many merge like you describe you have.
> >>
> >> A full join in proc sql would be a lot better.
> >>
> >> Take a look at:
http://www2.sas.com/proceedings/forum2007/071-2007.pdf
> >>
> >> HTH,
> >> Art
> >> -------
> >> On Sat, 12 Feb 2011 13:33:31 -1000, John Parker
<John.V.Parker@KP.ORG>
> >> wrote:
> >>
> >> >Hi,
> >> >I should be able to figure this out but I'm not having any luck.
> >> >I have two data sets that I'm trying to merge.
> >> >I want all of the data from both data sets to be in the new data
set.
> >> >Both data sets contain multiple instances of the same patientid.
> >> >I have tried using a by statement but it gives me an error letting
me
> >know
> >> >that
> >> >
> >> >MERGE statement has more than one data set with repeats of BY
values.
> >> >from what I understand about the merge statement, if you want the
data
> >> >from both data sets you don't use a by statement.
> >> >The variables in both data sets are the same name, length and type.
> >> >This is what I have:
> >> >
> >> >data yr1.new_data;
> >> >merge yr1.ds1 yr1.ds2;
> >> >run;
> >> >Basically the two data sets are not merging.
> >> >This is the note I get in the log
> >> >
> >> >NOTE: There were 21089 observations read from the data set YR1.DS1.
> >> >NOTE: There were 57955 observations read from the data set YR1.DS2.
> >> >NOTE: The data set YR1.new_data has 57955 observations and 13
> >variables.
> >> >
> >> >It contains all of the data from DS2 not DS1.
> >> >
> >> >So, what am I doing wrong?
> >> >
> >> >Thanks,
> >> >
> >> >John
|