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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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