Reputation: 11
I'm trying to create a table using a sql procedure with a column in date9
format, however, despite the put function I use with the date9
parameter, my column is created in string format, even though I have no error indicated in the log.
Here is what my code looks like:
rsubmit;
proc sql;
create table temp as (
select put(intnx('month', datepart(MyDateTimeColumn), -1, 'e'),date9.) as FormatedDate
from MyTable
);
quit;
endrsubmit;
Could you please help me?
Thanks in advance,
AZ
Upvotes: 1
Views: 1736
Reputation: 51611
Why did you use the PUT() function if you did not want to create a string? FORMATS convert values into text.
If you want the date values to be displayed in ddMMMyyyy style then just attach the DATE9. format to the date variable.
proc sql;
create table temp as
select intnx('month', datepart(MyDateTimeColumn), -1, 'e')
as FormatedDate format=date9.
from MyTable
;
quit;
Upvotes: 2