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 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 7 Jul 2006 18:39:13 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: problem counting days between dates
Comments: To: gscsrc@hotmail.com
In-Reply-To:  <1152296923.989516.211330@h48g2000cwc.googlegroups.com>
Content-Type: text/plain; format=flowed

Greg ,

The input function expects a character value as its first argument. It looks like your first argument is numeric. Which makes me think they are already SAS DateTime values. Now if that is the case and you want to compare the two dates minus the time part, then you need to do the follo0wing:

data test2 ; set test ; where cndtlet > '31DEC2002:00:00:00'dt ; DayDiff = DatePart( Cndt61 ) - DatePart( Cndt62 ) ; run ;

Toby Dunn

From: Greg Curson <gscsrc@HOTMAIL.COM> Reply-To: gscsrc@HOTMAIL.COM To: SAS-L@LISTSERV.UGA.EDU Subject: problem counting days between dates Date: Fri, 7 Jul 2006 11:28:44 -0700

I need to count the days between cndt61 and cndt62

Why does not my input covert all the dates? What do I need to do to fix this? Thanks, Greg

data test2; set test; where cndtlet > '31DEC2002:00:00:00'dt; sas_date1 = input(CNDT61, yymmdd8.); sas_date2 = input(CNDT62, yymmdd8.); time=sas_date1-sas_date2; run;

142 + 143 +data test2; 144 +set test; 145 +where cndtlet > '31DEC2002:00:00:00'dt; 146 +sas_date1 = input(CNDT61, yymmdd8.); 147 +sas_date2 = input(CNDT62, yymmdd8.); 148 + 149 + 150 +time=sas_date1-sas_date2; 151 +run;

NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 146:19 147:19 NOTE: Invalid argument to function INPUT at line 146 column 13. NOTE: Invalid argument to function INPUT at line 147 column 13. CCONTID=B -26774 CNDT61=12OCT2005:00:00:00 CNDT62=04SEP2004:00:00:00 CNDT63=23JUN2006:00:00:00 CNDISTR=610 CNDTLET=23MAR2004:00:00:00 sas_date1=. sas_date2=. time=. _ERROR_=1 _N_=1 NOTE: Invalid argument to function INPUT at line 146 column 13. NOTE: Invalid argument to function INPUT at line 147 column 13. CCONTID=B -26810 CNDT61=29NOV2004:00:00:00 CNDT62=14NOV2004:00:00:00 CNDT63=13JUN2006:00:00:00 CNDISTR=640 CNDTLET=17DEC2003:00:00:00 sas_date1=. sas_date2=. time=. _ERROR_=1 _N_=2


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