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 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 22 Feb 2006 14:03:12 -0500
Reply-To:   Tony Yang <tonyyangsxz@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Tony Yang <tonyyangsxz@GMAIL.COM>
Subject:   Re: Merge
Comments:   To: TK <Tony.Kelleher@cso.ie>
In-Reply-To:   <1140611473.975477.35780@g43g2000cwa.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1

Here is another data step merging, but is not simple using PROC SQL. Anyway, it works.

data cctr; input cctr $ date date9. count; format date date9.; cards; 1 1jan2006 10 1 4jan2006 8 2 1jan2006 5 2 2jan2006 2 2 3jan2006 6 3 4jan2006 9 3 5jan2006 7 ; proc sort data=cctr; by cctr date;

data cctr; set cctr; by cctr; if first.cctr then flag=0; flag+1;

proc sort data=cctr; by cctr flag ;

data new(drop=flag); set cctr; by cctr; if last.cctr then do; do i=flag+1 to 5; count=0; output; end; end; data new; set new(rename=(i=flag)) cctr; proc sort data=new; by flag ; run;

data alldays1; input date date9. dayname $ holiday $; format date date9.; flag+1; cards; 1jan2006 Sunday Y 2jan2006 Monday N 3jan2006 Tuesday N 4jan2006 Wednesday N 5jan2006 Thursday N ; data new2(drop=i); set alldays1; do i=1 to 3; output; end;

proc sort data=new2; by flag ;

data er(drop=flag); merge new new2; by flag;

proc sort data=er; by cctr date;

proc print data=er; run;

Best regards, Tony


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