Prev: How to schedule a execution of a macro daily
Next: Is there a system macro var that indicates if running batch
From: Arthur Tabachneck on 28 Jan 2010 19:50 I think you may only need a format like: YYMMDDN8. e.g., data have; informat DateOld date9.; format DateOld mmddyy10.; input DateOld; cards; 3nov2009 ; data want; set have; DateNew = put (DateOld, YYMMDDN8.); run; HTH, Art ------------- On Jan 28, 6:10 pm, Sdlentertd <sdlente...(a)gmail.com> wrote: > 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: Tom Abernathy on 28 Jan 2010 20:55 If you want to display the DATE without the delimiter then use the YYMMDDN format. I am not sure what you want in the 11 column, but FORMAT dateold yymmddn10. will display as 20091103. Now if you want to convert your DATE value to a NUMBER that happens to look like a date then use the PUT and INPUT functions. Example: non_date = input(put(realdate,yymmddn10.),10.); Then you could apply the format 11. (or its alias N11.) to this new numeric variable and it will print the 10 digit number in 11 characters. - Tom On Jan 28, 6:10 pm, Sdlentertd <sdlente...(a)gmail.com> wrote: > 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: Tom Abernathy on 29 Jan 2010 00:05
On Jan 28, 8:55 pm, Tom Abernathy <tom.aberna...(a)gmail.com> wrote: > If you want to display the DATE without the delimiter then use the > YYMMDDN format. > I am not sure what you want in the 11 column, but FORMAT dateold > yymmddn10. will display as 20091103. > > Now if you want to convert your DATE value to a NUMBER that happens to > look like a date then use the PUT and INPUT functions. > Example: > non_date = input(put(realdate,yymmddn10.),10.); > > Then you could apply the format 11. (or its alias N11.) to this new > numeric variable and it will print the 10 digit number in 11 > characters. > > - Tom > > On Jan 28, 6:10 pm, Sdlentertd <sdlente...(a)gmail.com> wrote: > > > > > 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.- Hide quoted text - > > - Show quoted text - actually the length of a date is 8 instead of 10 when you remove the delimiters. So I am not sure what the extra 3 spaces are for. Also it is F8. not N8. that is the equivalent of the 8. format. |