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 (August 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 15 Aug 2000 10:29:12 -0400
Reply-To:   "Kerrison, James" <James.Kerrison@FMR.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Kerrison, James" <James.Kerrison@FMR.COM>
Subject:   Re: Weekday function
Comments:   To: "Brucken, Nancy" <Nancy.Brucken@pfizer.com>
Content-Type:   text/plain; charset="iso-8859-1"

OK. Nancy's works best for me. Thanks also to Louis, Peter, Laurie, and Raphael.

The benefit of this code is that I can add other counting vars starting @ 0 - see code modifications below, whereas the other examples you sent started me at the value of bdate. You all sent me great code, but this one works best for my process. Replacing dax with the weekday function in the if statement cuts one line of code - see code modifications.

Thanks again,

Foster.

-----Original Message----- From: Brucken, Nancy [mailto:Nancy.Brucken@pfizer.com] Sent: Tuesday, August 15, 2000 10:05 AM To: 'Kerrison, James' Subject: RE: Weekday function

Hi Foster, The following code works for me:

%let bdate = 20000807; * The start date ; %let edate = 20000815; * the finish date ;

%let daysin = %eval(&edate-&bdate) ; * The number of days ;

data buckets ; format xdate mmddyy8. ;

xdate = input("&bdate",yymmdd8.); do i = 0 to &daysin; dax = weekday(xdate) ; ***** delete this - see below....; if dax not in (1,7) then output ; ******* replace with **** if weekday(xdate) not in (1,7) then output ; xdate + 1 ; basket + 1 ; ****** additional counting var ; end ; run ;

proc print ; title 'test '; run ;

I rearranged your output statement slightly, took out the determination of THE (since I couldn't see it used anywhere, and modified a few other things a bit.

Hope this helps, Nancy

Nancy Brucken Clinical Informatics Pfizer Global Research & Development, Ann Arbor (734) 622-5767 E-mail address: Nancy.Brucken@wl.com

-----Original Message----- From: Kerrison, James [mailto:James.Kerrison@FMR.COM] Sent: Tuesday, August 15, 2000 9:36 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Weekday function

See the code and output below. What I want is to create a set of dates from August 7 through 15th - excluding Saturdays and Sundays. I have tried various plays on taking weekday 1 and 7 out, but no joy. Can anyone see the problem?

TIA,

Foster Kerrison.

%let bdate = 20000807; * The start date ; %let edate = 20000815; * the finish date ;

%let daysin = %eval(&edate-&bdate) ; * The number of days ;

data buckets ; format xdate mmddyy8. ;

do i = 0 to &daysin; xdate = input("&bdate",yymmdd8.); the = i; xdate +i ; dax = weekday(xdate) ; if dax = 1 then delete ; * when I leave this out all the records are created!!!; output ; end ; run ;

proc print ; title 'test '; run ;

test 09:25 Tuesday, August 15, 2000 1

OBS XDATE I THE DAX

1 08/07/00 0 0 2 2 08/08/00 1 1 3 3 08/09/00 2 2 4 4 08/10/00 3 3 5 5 08/11/00 4 4 6 6 08/12/00 5 5 7


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