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 (April 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 27 Apr 2005 14:55:22 -0400
Reply-To:   Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:   Re: creating a date variable displaying all days in year
Comments:   To: nevin.krishna@GMAIL.COM

On Wed, 27 Apr 2005 11:36:16 -0700, nevin.krishna@GMAIL.COM wrote:

>Hi one follow up question, > >I used the code you suggested and it worked great..now i am trying to >add another column to include another year of data.. >please see the following code, when i run it, it correctly creates two >variables,and the data for year 2005 is correct, but the 2004 column >does not dispaly data until line 366.. >morevover, it 2006 data is now appended to the 2005 column after line >366..How do i display just 2004 and 2005 side by side..(so that there >are only 365 obs)? Hope this is not too confusing...thanks again for >your help..Nevin > > > data comp_date; > do date05 = '01jan2005'd to '31dec2005'd; > output; > end; > do date04 ='01jan2004'd to '31dec2004'd; > output; > end; > format date05 date04 date7.; >run;

/* create 365 observations date04 ranges from '01jan2004'd to '30dec2004'd date05 ranges from '01jan2005'd to '31dec2005'd */ data comp_date; drop _delta; do _delta = 1 to 365; date04 = '31dec2003'd + _delta; date05 = '31dec2004'd + _delta; output; end; format date04 date05 date7.; run;

/* check */ proc print data=comp_date; run;

/* on lst -- parts Obs date04 date05

1 01JAN04 01JAN05 2 02JAN04 02JAN05 3 03JAN04 03JAN05 ... 362 27DEC04 28DEC05 363 28DEC04 29DEC05 364 29DEC04 30DEC05 365 30DEC04 31DEC05 */


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