Date: Thu, 11 Apr 1996 13:37:41 EDT whitloi1@WESTATPO.WESTAT.COM "SAS(r) Discussion" Ian Whitlock Re[2]: week number calculation To: Juha Kari

Juha,

You don't have to count Sundays. In the lag below WK1 is counting Mondays and WK2 is counting Sundays.

2 3 data _null_ ; 4 dt = '1jan96'd ; 5 day = weekday ( dt ) ; 6 put day = ; /* 2 */ 7 wk2 = intck ( 'week.2' , '1jan96'd , '7jan96'd ) ; 8 put wk2= ; 9 wk1 = intck ( 'week' , '1jan96'd , '7jan96'd ) ; 10 put wk1 = ; 11 run ;

DAY=2 WK2=0 WK1=1 NOTE: DATA statement used: real time 0.14 seconds cpu time 0.04 seconds

Ian Whitlock <whitloi1@westat.com>

______________________________ Reply Separator _________________________________ Subject: Re: week number calculation Author: Juha Kari <juha.kari@TUKO.ELISA.FI> at internet-e-mail Date: 4/11/96 12:59 PM

Thanks for everybody who answered to me by email. The solution seems to be INTCK function which calculates number of Sundays between two days. There is still the problem on which day the week no. 1 starts? Is week no. 1 the week, which have 4 or more days on new year? or...

Juha *************************************************************** Juha Kari * Phone: +358-0-6197015 Tuko Oy * Fax: +358-0-6196157 PL 1050 * Email: Juha.Kari@tuko.elisa.fi 00101 HELSINKI * X.400:S=kari;g=juha;p=tuko;a=elisa;c=fi FINLAND * Opinions are my owns, not Company's *************************************************************** I only use recycled letters!

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