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 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 11 Nov 1996 13:18:09 +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: Help ! Retaining a value...
Comments: To: slowhand@UIUC.EDU

Hi,

You should not merge the two datasets. Try to read the first one at the start of your datastep and then read the second one (the one with 2000 obs).

E.G:

data third; if _n_ =1 then set first; set second; run;

This should work ok if you don't have the same variables name in first and second; otherwise rename your variable in one .

Regards, 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 Mon Nov 11 11:46 EST 1996 >>>Nntp-Posting-Host: agec73.agecon.uiuc.edu >>>Mime-Version: 1.0 >>>Content-Transfer-Encoding: 7bit >>>Date: Tue, 5 Nov 1996 01:30:22 -0600 >>>From: Slowhand <slowhand@UIUC.EDU> >>>Subject: Help ! Retaining a value... >>>To: Multiple recipients of list SAS-L <SAS-L@UGA.CC.UGA.EDU> >>> >>>Hi folks, >>> >>>I have the following problem : >>> >>>My overall objective is this : I have two datasets. From one dataset, >>>I want to compute a median, etc, and >>>use this value in a formula that has variables from a second data >>>set. ie, in the formula, there will be observations (2000 of them) >>>read from the second data set, and I want to use the median I calculated >>>from the first data set and calculate a new variable based on the >>>formula. The new variable will thus have 2000 observations itself. >>> >>>The problem I have is regarding using the median value I calculate >>>from the first dataset in the formula. I use proc univariate to >>>calculate the median from the first dataset, and save it to an output >>>file (thus this output file has exactly one observation). Now I open >>>a new dataset of 2000 observations, and I want to use the median >>>value I calculated above, in conjunction with each of the 2000 >>>observations, one at a time to create a new variable based on the >>>formula. But the problem is, the data set with the median value in it >>>has one observation while the other dataset has 2000 observations. >>>When I use merge, it just puts missing values for the median in the >>>rest of 1999 observations. >>> >>>The only way I know right now to handle this is to use two different >>>programs - first calculate the median, then manually write it down. >>>and plug in that written down value as a parameter in the second >>>program. But this is terribly inefficient ! >>> >>>Any help would be greatly appreciated. >>> >>> >>>Thanks in advance, >>> >>>Bhavani Shankar >>>b-shank@uiuc.edu


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