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 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Apr 2004 11:18:10 -0600
Reply-To:     Kenneth Moody <KennethMoody@FIRSTHEALTH.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Kenneth Moody <KennethMoody@FIRSTHEALTH.COM>
Subject:      Re: Date assignment
Content-Type: text/plain; charset=us-ascii

Here's an example of one way to do this:

data _null_; do x = '29dec2003'd to '15jan2004'd; week = intck('week.2', '29dec2003'd, x); monday = intnx('week.2', x, 0); put x date9. monday date9. week 4.; end; run;

Note that using the .2 modifier on week specifies that the week begins on Monday.

Ken

>>> "0101 htns" <htns0101@YAHOO.COM> 04/15/04 09:38AM >>> Hi all,

I need help on finding an efficient way to assign 7 days to a week.

Here's my expected output:

Date Week

29DEC2003 week 1

30DEC2003 week 1

31DEC2003 week 1

01JAN2004 week 1

02JAN2004 week 1

03JAN2004 week 1

04JAN2004 week 1

05JAN2004 week 2

06JAN2004 week 2

07JAN2004 week 2

08JAN2004 week 2

09JAN2004 week 2

10JAN2004 week 2

11JAN2004 week 2

...

10APR2004 week 16

11APR2004 week 16

12APR2004 week 16

13APR2004 week 16

14APR2004 week 16

15APR2004 week 16

...

Essentially, there are 52 weeks in a year. This year, week one starts from 12/29/2003 and week 52 ends on 12/26/2004 (including 12/26/2004)

Any help would be greatly appreciated.

Huong

--------------------------------- Do you Yahoo!? Yahoo! Tax Center - File online by April 15th


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