BookmarkSubscribeRSS Feed
Reeza
Super User

Show it. All you've shown so far is a DATE var which we all know doesn't work. 

Patrick
Opal | Level 21

@sas_td2016

As other mentioned earlier you SQL Server column appears to be of data type DATETIME and not DATE.

 

I would have expected SAS to convert your SAS Date value to a SQL DateTime value when loading into the SQL table but it appears that's not happening.

 

Without you providing us with more information we can't say much more about it.

 

As other's already suggested try  and pass in a SAS DateTime value instead of a Date value as done in code below:

proc sql;
  insert into sql.mortage
    (loan_number, due_date, investor_numer, bankruptcy_flag, ltv)
  values
    (1000001, '01jan2016 00:00:00'dt, 200001,'N',0.8)
  ;
quit;

 

If things still don't work then please add the following options statements before your SQL and then post the log:

options sastrace=',,,d' sastraceloc=saslog nostsuffix;

 

Also: If you run a Proc Contents for table SQL.MORTGAGE what's the format on column DUE_DATE?

 

SAS uses this format to determine how to covert SAS Date and DateTime values to the target database representation when loading. I've made the experience that this doesn't work for all formats but that you can rely on formats DATE9. and DATETIME20.

 

If data conversion doesn't work as expected then another option is to explicitely "tell" SAS using option DBSASTYPE

http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371572.htm

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 16 replies
  • 2012 views
  • 1 like
  • 4 in conversation