Help using Base SAS procedures

Date (numeric) variable incorrectly interpreted - How can I change format

Reply
N/A
Posts: 0

Date (numeric) variable incorrectly interpreted - How can I change format

Hi

Please can someone help me solve this riddle.

I have a (system generated) NUMERIC variable in SAS which looks like this: 04AUG2006:00:00:00
It has both 'format & Informant' of Datetime20. However I need to create a new variable based on the ddmmyy. I've tried everything from substr to input, but it seems to give me an error and recognises the year as 1963. Any tips will be deeply appreciated:-)

Cheers!
Respected Advisor
Posts: 3,777

Re: Date (numeric) variable incorrectly interpreted - How can I change format

I think you could simply use datepart function

new = datepart(old);
format new date9.;
N/A
Posts: 0

Re: Date (numeric) variable incorrectly interpreted - How can I change format

Thankyou so much - that has worked brilliant.
Cheers
Ask a Question
Discussion stats
  • 2 replies
  • 93 views
  • 0 likes
  • 2 in conversation