proc sql;
create table test as
select loan.data_date as as_of_date
from have
;quit;
output looks like this
as_of_date
************
In other words the date has a date type variable however its truncated and not showing the actual date. I tried using to_date(loan.data_date as as_of_date) however I ger t function not present when using this. How can I get the actual date to avoid truncation?
@Q1983 wrote:
output looks like this
as_of_date
************In other words the date has a date type variable however its truncated and not showing the actual date. I tried using to_date(loan.data_date as as_of_date) however I ger t function not present when using this. How can I get the actual date to avoid truncation?
Where are you looking to see these ********* values? Please be specific. Or show us a screen capture (use the "Insert Photos" icon to include your screen capture in your reply; do not attach files).
Also, what is the format assigned to the variable AS_OF_DATE according to PROC CONTENTS?
Also, there is no TO_DATE function in SAS PROC SQL. (Some SAS PROC SQL code might use TO_DATE if it passes thru to a database such as Oracle that does have the TO_DATE function). What operation you are trying to do with this function?
One reason could be the format applied. Try if below helps
proc sql;
create table test as
select loan.data_date as as_of_date format=datetime21.
from have
;quit;
Should the dates then all show year 1960 then try format=date9. instead.
This can not be the code that created the dataset, as it won't run (alias loan does not exist). Please post the complete, unchanged log from your real code.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.