Prev: How to display indent and blank line break in pdf/rtf output?
Next: How to schedule a execution of a macro daily
From: Sdlentertd on 28 Jan 2010 18:10 I have this problem: DateOld MMDDYY10. (numeric) format and looks like this 11/03/2009 and I want to create a new date based on DateOld in this format DateNew 11. (numeric) which will look like this 20091103 i am trying this but it doesn't work DateNew = input( put (DateOld, 8.), YYMMDD8.); Thanks for help.
From: "Schwarz, Barry A" on 29 Jan 2010 10:35
Actually DateOld does not look like that at all. The character string you see is the result of applying the format to the actual value. That value is an integer count of the number of days from the start of the epoch. It is something on the order of 18000 (almost 50 years times 365.25 days per year). Now looking at the statement you tried to use DateNew = input( put (DateOld, 8.), YYMMDD8.); PUTting Dateold with a format of 8. produces ' 18000'. Then, INPUTting that with a format of YYMMDD8. gives a numeric date value in the year 1, month 80, day 0. If you really have need for a character variable, then you could use DateNew = put(DateOld, YYMMDDN8.); If all you want is to print DateOld in the new format, just use the YYMMDDN8. format in you put statements and ignore the default format assigned to the variable. -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Sdlentertd Sent: Thursday, January 28, 2010 3:11 PM To: SAS-L(a)LISTSERV.UGA.EDU Subject: Converting Numeric MMDDYY10. into 11. numeric I have this problem: DateOld MMDDYY10. (numeric) format and looks like this 11/03/2009 and I want to create a new date based on DateOld in this format DateNew 11. (numeric) which will look like this 20091103 i am trying this but it doesn't work DateNew = input( put (DateOld, 8.), YYMMDD8.); |