Hi,
how to transform this string value into a timestamp format like dd.mm.yyyy hh:mm?
17.02.22 08:06This 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):
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.