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 (February 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 6 Feb 2002 07:53:22 -0500
Reply-To:   Edward Heaton <HEATONE@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Comments:   To: N Yiannakoulias <nwy@SRV.UALBERTA.CA>
From:   Edward Heaton <HEATONE@WESTAT.COM>
Subject:   Re: Dates again
Comments:   To: SAS-L@LISTSERV.VT.EDU
Content-Type:   text/plain

Whoever you are; Why are you bothering with character representations of dates? SAS has an acceptable method of dealing with date; it's a number that represents the days since Jan 1, 1960. You might change your code to the following:

1 %let startDate = "02Feb1999"d ; 2 %let endDate = "01Jan2000"d ; 3 Data _null_ ; 4 sDate = "30Apr1999"d ; 5 If ( &startdate <= sdate <= &enddate ) then put "It worked!" ; 6 Run ;

It worked!

Now, to your code. The only explanation I can guess at given the brevity of your description of the problem is that some of your character dates are not convertable by YYMMDD8.

Ed

Ed Heaton #4818 TA-2018

-----Original Message----- From: N Yiannakoulias [mailto:nwy@SRV.UALBERTA.CA] Sent: Tuesday, February 05, 2002 2:47 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Dates again

Always probems with dates...

Inside a macro I define two values like this:

%LET startdate="19990202"; %LET enddate="20000101";

then later on, in a data step, I want to use these dates:

[...]

1. sdate=input(dates,yymmdd8.); 2. IF input(&startdate,yymmdd8.) <= sdate <= input(&enddate,yymmdd8.) THEN OUTPUT p1_1;

[...]

But SAS is unhappy with the input arguments in line 2. I have no clue what's wrong with this probably simple task. Can you help?

N

-- ----------------------------------------------- Conveniently located at lat 53 31'.01, lon 113 30'.26


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