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 (July 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 14 Jul 1999 10:38:50 -0400
Reply-To:     Tim Vorce <timv@TRILLIUMTEAM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         timv@TRILLIUMTEAM.COM
Subject:      Re: Calculate Duration in # of days
Comments: To: Rashida Z Patwa <rashida.patwa@HIGHMARK.COM>
In-Reply-To:  <F5639E63DD99D211888F00C00D008A4C1425B5@PRIMARY>
Content-Type: text/plain; charset="iso-8859-1"

The function you are using intck calculates the number of days between two dates as days=('day',"01JUL99"D,"05JUL99"D); gives 5.

If you want to compute a date that is relative to another, use intnx. The following call gives the date for yesterday:

strt=intnx('day',today(),-1);

Tim Vorce (248) 586-1999 tvorce@trilliumteam.com Trillium Teamologies In the last resort, nothing is ridiculous except the fear of being so. -Unknown

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Rashida Z Patwa Sent: Tuesday, July 13, 1999 1:53 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Calculate Duration in # of days

Hello.

I want someone to tell me why I am getting the following result when I am trying to calculate for a date after 90 days of a given date. I don't know why I am getting a negative indicator on the sas date "BNFT"??? When I tried this code using interactive SAS I did not get the negative indicator, and also got the correct effective date after 90 days. But in the same code when running thru batch under MVS(SAS 6.09) I get the following results. I had to use the function ABS to get rid of negative. The result in "SDATE" is actually 90 days prior of the effective date, instead of 90 days after. I am really confused!! Could someone please help me to clarify and explain. Also, is there any other easier way to calculate # of days between the 2 dates? Thanks.

Batch job - DATA DURATION(KEEP=SBCNTRID EFFDATE SDATE BNFT); SET MERGED; BNFT=INTCK('DAY',EFFDATE,90); SDATE=ABS(BNFT); RUN; PROC PRINT DATA=DURATION(OBS=20); FORMAT SDATE MMDDYY6.; RUN;

OBS SBCNTRID EFFDATE BNFT SDATE

1 HE1899406 09SEP97 -13676 061197 2 HE1899406 09SEP97 -13676 061197 3 HE1904892 . . . 4 HE1904892 . . . 5 HE1904930 16APR99 -14260 011699 6 HE1904930 16APR99 -14260 011699 7 HE1905546 01JUL97 -13606 040297 8 HE1905546 01JUL97 -13606 040297 9 HE1905546 01JUL97 -13606 040297 10 HE1905546 01JUL97 -13606 040297 11 HE1905953 01JUL97 -13606 040297 12 HE1905953 01JUL97 -13606 040297 13 HE1905953 01JUL97 -13606 040297

When I used -90 in the INTCK function I got the correct date after the 90 days of the effective date! See the code and results.

DATA DURATION(KEEP=SBCNTRID EFFDATE SDATE BNFT); SET MERGED; BNFT=INTCK('DAY',EFFDATE,-90); SDATE=ABS(BNFT); RUN; PROC PRINT DATA=DURATION(OBS=20); FORMAT SDATE MMDDYY6.; RUN;

OBS SBCNTRID EFFDATE BNFT SDATE

1 HE1899406 09SEP97 -13856 120897 2 HE1899406 09SEP97 -13856 120897 3 HE1904892 . . . 4 HE1904892 . . . 5 HE1904930 16APR99 -14440 071599 6 HE1904930 16APR99 -14440 071599 7 HE1905546 01JUL97 -13786 092997 8 HE1905546 01JUL97 -13786 092997 9 HE1905546 01JUL97 -13786 092997 10 HE1905546 01JUL97 -13786 092997 11 HE1905953 01JUL97 -13786 092997 12 HE1905953 01JUL97 -13786 092997 13 HE1905953 01JUL97 -13786 092997

SDATE in the example above generated the correc date after 90 days.

Any help would be appreciated. Thank you.


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