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 (November 1996, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 21 Nov 1996 09:18:14 +0500
Reply-To:     Bernard Tremblay <bernard@CAPITALE.QC.CA>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Bernard Tremblay <bernard@CAPITALE.QC.CA>
Subject:      Re: Merge with unequal obs.
Comments: To: statsoft@STAT.MATH.ETHZ.CH

Hi, You don't need to merge you datasets in that particular case. The first time, your read an observation from both files, and then, your keep on reading on the second file. Here's an example:

data combi; if _n_ = 1 then set d2; set d1; run;

That's all!

Good luck, Bernard Tremblay

\\\|/// \\ - - // ( @ @ ) +------oOOo-(_)-oOOo----------+---------------------------------+ | Bernard Tremblay | Bureau: (418) 646-2401 | | La Capitale | Maison: (418) 878-4447 | | |Internet: bernard@capitale.qc.ca | | | bertrem@quebectel.com | +---------------Oooo----------+---------------------------------+ oooO ( ) ( ) ) / \ ( (_/ \_)

>>>From owner-sas-l@UGA.CC.UGA.EDU Thu Nov 21 03:42 EST 1996 >>>Date: Thu, 21 Nov 1996 09:41:20 +0100 >>>From: Statistik Mail <statsoft@STAT.MATH.ETHZ.CH> >>>Subject: Merge with unequal obs. >>>To: Multiple recipients of list SAS-L <SAS-L@UGA.CC.UGA.EDU> >>> >>>Hi SAS folks, >>> >>>I am going to merge two data sets with unequal observations and no common >>>identification variable (i.e. ID variable). Imagine a situation that >>>emerges from fitting a random effects model with PROC MIXED yieling a data set >>>containing teh random coefficients for each person (obs=1000) and a data >>>sets with the fixed effects (obs=1). To get the shrunken estimates I 'd >>>like to sum up the fixed and random effects, i.e. shrink=beta_f + beta_r. >>>I created a code as follows, but onlz the 1st obs. contains the fixed >>>effect. >>>data d1; * read random data ; >>> input id beta_r; >>>cards; >>>1 11 >>>2 12 >>>3 13 >>>; >>>data d2; * read fixed data; >>> input beta_f; >>>8 >>>; >>>data combi; >>> merge d1 d2; >>>PROC PRINT; >>> >>>run; >>> >>>=>Output: >>> >>>obs id beta_r beta_f >>>1 1 11 8 >>>2 2 12 . >>>3 3 13 . >>> >>>How can you tell SAS to retain the value of beta_f in all records so that >>>the sum vector can be calculated? I really don' t like these missing values >>>following the 2nd records! >>>Of course I could do a do i=1 to 100 loop to output the fixed variable >>>value 100 times, but this is not a very elegant solution. >>> >>>I am sure someone has come across with an easier solution. Any help would be >>>greatly appreciated. >>> >>>Thanks a lot >>> >>> Dominik >>> >>> >>>Seminar fuer Statistik, ETH (Federal Inst. of Technology) >>>Zurich, SWITZERLAND, www: http://www.stat.math.ethz.ch/ >>>


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