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 (November 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 12 Nov 2007 20:41:15 -0500
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: Date from Character Input
Comments: To: SUBSCRIBE SAS-L Chandra Gadde <ddraj2015@GMAIL.COM>

Chandra,

If you can accept date9. as the output format, i.e. without the dashes, then the following might do what you want:

data have; input datetime_char $22.; cards; 11/10/2000 12:00:00 AM 11/20/2000 12:00:00 AM 2/21/2000 12:00:00 AM 10/9/2000 12:00:00 AM 8/2/2000 12:00:00 AM ;

data want; set have; format date date9.; date=datepart(input(datetime_char,ANYDTDTM22.)); run;

HTH, Art -------- On Mon, 12 Nov 2007 16:21:20 -0500, SUBSCRIBE SAS-L Chandra Gadde <ddraj2015@GMAIL.COM> wrote:

>Actually, I have this column in a SAS Dataset. I need to take this column >from a sas dataset and create a another column with date9. format > >Thanks for the help. > > >On Mon, 12 Nov 2007 15:15:03 -0600, data _null_, <datanull@GMAIL.COM> wrote: > >>It is not clear to me where this COLUMN is. You can read the date >>part and ignore the time. >> >>151 data _null_; >>152 input; >>153 list; >>154 date = input(_infile_,mmddyy10.); >>155 put (_all_)(=); >>156 format date date9.; >>157 cards; >> >>date=10NOV2000 >>RULE: ----+----1----+----2----+----3----+----4----+----5----+----6-- - >>158 11/10/2000 12:00:00 AM >>date=20NOV2000 >>RULE: ----+----1----+----2----+----3----+----4----+----5----+----6-- - >>159 11/20/2000 12:00:00 AM >>date=21FEB2000 >>160 2/21/2000 12:00:00 AM >>date=09OCT2000 >>161 10/9/2000 12:00:00 AM >>date=02AUG2000 >>162 8/2/2000 12:00:00 AM >> >> >>On Nov 12, 2007 2:46 PM, SUBSCRIBE SAS-L Chandra Gadde >><ddraj2015@gmail.com> wrote: >>> Hi All, >>> >>> I have a character column that looks like this. >>> >>> 11/10/2000 12:00:00 AM >>> 11/20/2000 12:00:00 AM >>> 2/21/2000 12:00:00 AM >>> 10/9/2000 12:00:00 AM >>> 8/2/2000 12:00:00 AM >>> >>> All I need is DATE format data from this input. In otherwords, I need to >>> convert the above data into the following (DATE9. format). >>> >>> 10-Nov-00 >>> 20-Nov-00 >>> 21-Feb-00 >>> 09-Oct-00 >>> 02-Aug-00 >>> >>> Could you please let know how I can do it in SAS? >>>


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