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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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