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 (July 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 14 Jul 2003 17:21:48 -0400
Reply-To:     Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:      Re: simple data set merge/appending ??

I suggest a couple of SQL views to set things up:

proc sql;

create view both as select * from First union select * from Second order by ID, year; create view shell as select * from (select distinct ID from both), (select distinct year from both) order by ID, year;

quit;

Then just a simple UPDATE to get the desired output:

data with_missing; update shell both; by ID year; run;

On Mon, 14 Jul 2003 13:34:38 -0700, JM Doyle <doylejm@JMU.EDU> wrote:

>Hi, >I want to append/merge two data sets that look like this: > >First data set is: > >ID YEAR XVAR >1 2001 10 >2 2001 16 > >Second data set is: > >ID YEAR XVAR >1 2002 11 >2 2002 17 >3 2002 19 > >I want the combined data to allow for a missing obs. for ID=3 in 2001 like this: > >ID YEAR XVAR >1 2001 10 >1 2002 11 >2 2001 16 >2 2002 17 >3 2001 . >3 2002 19 > >With a merge or a set command, I don't get the missing observation in 2001 for ID=3. > >Any help would be appreciated. Thank you


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