'SAS : Problem with put function in a proc sql
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
Solution 1:[1]
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;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tom |
