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 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 2 Nov 2007 09:42:02 -0500
Reply-To:   "data _null_," <datanull@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "data _null_," <datanull@GMAIL.COM>
Subject:   Re: Character date to Numeric value
Comments:   To: SAS_learner <proccontents@gmail.com>
In-Reply-To:   <c2192a610711020652w45aeb562p44c2db885ebc67c7@mail.gmail.com>
Content-Type:   text/plain; charset=ISO-8859-1

280 data _null_; 281 dtc='2007-01-30T17:49:00'; 282 iso=input(dtc,is8601dt.); 283 ymd=input(dtc,ymddttm.); 284 format iso ymd datetime20.; 285 put (_all_)(=); 286 run;

dtc=2007-01-30T17:49:00 iso=30JAN2007:17:49:00 ymd=30JAN2007:17:49:00

What is the error. Do all the DTC values contain complete datetime values as you show in the example Most/all of the DTCs I get have the seconds left off and I have to concatenate ':00' to get is8601dt to work.

iso2 = input(cats(dtc,':00'),ids8601dt.);

ymddttm. is able to deal with incomplete times.

On 11/2/07, SAS_learner <proccontents@gmail.com> wrote: > Hello All, > > I have date (ISO 8601 standard For Ex : 2007-01-30T17:49:00 ) I am trying > to convert it to numeric date, I checked every where for an informat to > convert it into sas Numerical date like this ; > > Data Dm ; > Set Mntx3301.Dm; > RFSDTC1 = Input( RFSTDTC , is8601dt. ) ; > Keep Usubjid subjid siteid RFSTDTC RFENDTC RFSTDTC1 ; > Run; > > This is giving me an error, > Then I thought of cutting it and putting it way the SAS likes > > > RFSDTC1 > =input(compress(put(scan(RFSDTC,2,'-'),$2.)||put(scan(RFSDTC,3,'-'),$2.)||put(scan(RFSDTC,1,'-'),$4.)),mmddyy8.); > > but is there a better way than this to do this., While converting this way I > would be ignoring the time part right so should I need to use datetime20. to > change exactly for character to Numeric. > > thank you all for the help >


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