BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

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?

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@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?

--
Paige Miller
Patrick
Opal | Level 21

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.

Kurt_Bremser
Super User

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.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 756 views
  • 1 like
  • 4 in conversation