I have a column called startdate with time values, like:
30JUN1948:00:00:00.000
07JAN1967:00:00:00.000
01FEB1953:00:00:00.000
...
When I tried to pass the time value to a new variable called start, like this:
data want;
set data have;
start = startdate;
run;The new column start looked like this:
-363052800
221443200
-218160000
...
I'd like to know how to pass the date time value to the new column with its original format? Thanks.
Give the new time variable an appropriate format 🙂
The value is the same, but you also need to apply the same display format. Run a PROC CONTENTS on your dataset, or inspect it with a dataset viewer in Enterprise Guide or SAS Studio and look at the variable Properties.
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.