Search code examples
sassas-dis

Why return string format for FINFO function in SAS EG and SAS DI is different


I am trying to get file "modeified" datetime with

datetimeString = finfo(fid,'Last Modified');``

In SAS EG the return string looks like 12Jan2023:11:03:53

But in SAS DI the return string looks like 12 January 2023 11:03:28

I am trying to convert a string to a datetime like below and obviously it doesn't work for EG and throw invalid argument error. moddate=input(finfo(fid,'Last Modified'),datetime20.);

I can fix this by writing bit of extra code in DI but would like to know why finfo(fid,'Last Modified'); return different string format?

I am working in data step.


Solution

  • Check the setting of the LOCALE option in the two different SAS sessions.

    You can use the NLDATM informat to read the string generated by FINFO()

    SAS Documentation on NLDATM informat

    Example program that uses NLDATM informat to get datetime from FINFO() function.