Search code examples
sasdataset

NOTE: Invalid numeric data, DateFrom='2018-01-11 18:30:00.000' , at line 85 column 20. DatePart option used to remove time from date


Data A_DateFrom;  
set Agent_Hist; 
DateFrom1=Datepart(DateFrom);
Format DateFrom1 date9.;
run;

In output DateFrom1 column is blank while running this code in SAS. It is giving some warning.


Solution

  • First run proc contents to see what is the type of DateFrom:

    proc contents data=Agent_Hist;
    run;
    

    I suspect it may be character. In that case first use input() function:

    data test;
      DateFrom='2018-01-11 18:30:00.000';
      DateFrom1 = input(DateFrom, yymmdd10.);
      format DateFrom1 date11.;
    run;