Reputation:
I have this number 90724
which is actually 24/07/2009
, how can output the number to that date format. Another example 100821 should 21/08/2010
data want
set testData;
format date ddmmyyyy.;
run;
Cheers
Upvotes: 0
Views: 89
Reputation:
You really need to learn about Informats. Another good introductory source is this UCLA site
What you really needed to specify is the format in which you have the dates - using the informat yymmdd6.
It uses a YearCutOff
option to determine which century a 2-digit year falls into see Adjusting Dates in a New Century & YEARCUTOFF= System Option
Note: The default is 1920 which spans the 100-year range between 1920 and 2019 - if your dates are outside this range then set the appropritate cutoff value using OPTIONS YEARCUTOFF=nnnn
;
data test;
dateNumber=100821; ProperDate=input(put(dateNumber,6.), yymmdd6.); output;/*ProperDate= 21AUG2010*/
dateNumber=90724; ProperDate=input(put(dateNumber,6.) , yymmdd6.); output;/*ProperDate=24JUL2009*/
format ProperDate date9.;
run;
Upvotes: 2