Hi guys
it shows 1jan1960 instead of today date
data w;
n=today();
format n dtdate9.;
run;
MAXIM 1: Read the Documentation!
From the documentation of the DTDATE format:
Expects a datetime value as input and writes date values in the form ddmmmyy or ddmmmyyyy.
(emphasis by me).
@BrahmanandaRao wrote:
Hi guys
it shows 1jan1960 instead of today date
data w; n=today(); format n dtdate9.; run;
SAS stores dates as number of days and datetime values as number of seconds.
What date do you think 22 thousand seconds into the year 1960 represents?
For a hint open this "spoiler".
424 data _null_; 425 days=date(); 426 seconds=datetime(); 427 put 'DAYS ' (4*days) (comma15. +1 date9. +1 dtdate9. +1 tod8.); 428 put 'SECONDS ' (4*seconds) (comma15. +1 date9. +1 dtdate9. +1 tod8.); 429 run; DAYS 22,625 11DEC2021 01JAN1960 06:17:05 SECONDS 1,954,840,911 ********* 11DEC2021 11:21:51
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.