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 1996, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 11 Feb 1996 23:25:46 +0000
Reply-To:     John Whittington <johnw@MAG-NET.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         John Whittington <johnw@MAG-NET.CO.UK>
Subject:      Re: Merging datasets
Comments: To: Jim Stansell <stansell@PILOT.MSU.EDU>

On Sun, 11 Feb 1996, Jim Stansell <stansell@PILOT.MSU.EDU> wrote:

>I'm trying to merge two datasets. TEMP1 has one variable (named MAX) >which has one observation. >TEMP2 has several other variables (none of which is named MAX), each >with approximately 5000 observations. > >I've tried the following: > >DATA TEMPFILE; > MERGE TEMP1 TEMP2; > >but obviously, the variable MAX ends up with 4999 missing >observations. What's the trick here, and what am I doing wrong?

Jim, by total coincidence, this is virtually identical to a similar question posted last week, which generated a lot of heated debate. The simple answer is that what you need is:

data tempfile; set temp2; if _n_=1 then set temp1; run;

If you really want to, you can add a 'RETAIN max;' at the start of the datasetep (this is what the 'heated discussion' was all about!) but, certainly for SAS 6.10, you don't actually need it, because the SET brings with it an implicit RETAIN of all vraibales (in this case just MAX) in dataset TEMP1.

Regards,

John

----------------------------------------------------------- Dr John Whittington, Voice: +44 1296 730225 Mediscience Services Fax: +44 1296 738893 Twyford Manor, Twyford, E-mail: johnw@mag-net.co.uk Buckingham MK18 4EL, UK CompuServe: 100517,3677 -----------------------------------------------------------


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