|
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
>
|