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 (May 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 19 May 2008 09:46:27 -0700
Reply-To:     "" <dc353@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "" <dc353@HOTMAIL.COM>
Subject:      merge question
Comments: To:
Content-Type: text/plain; charset=ISO-8859-1

I have three datasets. The first has shares and ID, the second has date, id, wgt and the third has date, id and exp(s).

The following code almost works but is there a way to do this with one merge statement? (If the first file has an ID that is not in test_merge I get one record added - I'd like to get a recorded added for each date)

proc sort data=barra.test_por; by ticker; proc sort data=barra.sap500_hist; by yearmonth ticker; proc sort data=barra.exp_9001_0805; by yearmonth ticker; run;

DATA barra.test_merge; merge barra.sap500_hist (in=b) barra.exp_9001_0805 (in=c) ; by yearmonth ticker; where yearmonth => 200703 and yearmonth =< 200704; if b then output; run;

proc sort data=barra.test_merge; by ticker;

data barra.test_merge2; merge barra.test_por barra.test_merge; by ticker; run;

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