Hi,
how to transform this string value into a timestamp format like dd.mm.yyyy hh:mm?
17.02.22 08:06
This is not working:
format BEGINN_TMP DATETIME19.;
BEGINN_TMP = input(BEGINN, DATETIME19.);
Hi @Hansmuffs,
With the usual German locale
options locale=DE_DE;
this works:
data have;
string='17.02.22 08:06';
run;
data want;
set have;
dt=input(string, nldatm.);
format dt nldatms14.;
run;
except for the year 2000 (!). So, better use 4-digit years, as we've learned end of last century.
Documentation of the surprising Y2K issue of the NLDATMw. informat :
data _null_;
input dt nldatm.;
put dt nldatms14.;
cards;
17.02.98 08:06
17.02.99 08:06
17.02.00 08:06
17.02.01 08:06
17.02.02 08:06
;
Log (Windows SAS 9.4M5 with locale DE_DE and YEARCUTOFF=1926):
753 data _null_; 754 input dt nldatm.; 755 put dt nldatms14.; 756 cards; 17.02.98 08:06 17.02.99 08:06 NOTE: Invalid data for dt in line 759 1-19. . RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 759 17.02.00 08:06 dt=. _ERROR_=1 _N_=3 17.02.01 08:06 17.02.02 08:06 NOTE: DATA statement used (Total process time):
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.