BookmarkSubscribeRSS Feed
Robin_moon
Fluorite | Level 6

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.

 

 

 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Give the new time variable an appropriate format 🙂

Kurt_Bremser
Super User

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 782 views
  • 0 likes
  • 3 in conversation