Help using Base SAS procedures

Problem in loading the SAS date to Oracle table column

Reply
N/A
Posts: 0

Problem in loading the SAS date to Oracle table column

Hi,
I have a requirement where i need to insert todays date from a dataset variable into the oracle table column(Date type). For inserting todays date into the sas dataset column, i am using today() function.
Consider a example:

data SAS.DATA_DATE;
load_date=today();
format load_date mmddyy10.;
run;

consider a table is already present in the oracle having a column load_date (DATE type).

Now i am inserting todays date using the following:

proc sql;
insert into Oracle.DATE (load_date) select (load_date) from SAS.DATA_DATE;
quit;

This is running fine but the load_date in oracle table is showing 1/1/1960 instead to todays date. Please help.
Super Contributor
Super Contributor
Posts: 3,174

Re: Problem in loading the SAS date to Oracle table column

Posted in reply to deleted_user
Search the SAS support http://support.sas.com/ website - here is a Google advanced search argument to use:

date oracle table site:sas.com

You want to check the validity of your SAS variable containing the date - a value of 1/1/1960 indicates a SAS numeric internal value of zero rather than the current date which is the number of days since 1/1/1960.

Scott Barry
SBBWorks, Inc.


Working with Dates in the SAS System
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304321.htm
Super User
Posts: 5,437

Re: Problem in loading the SAS date to Oracle table column

Posted in reply to deleted_user
This may apply to your problem:
http://support.sas.com/documentation/cdl/en/acreldb/61890/HTML/default/a001371624.htm

/Linus
Data never sleeps
N/A
Posts: 0

Re: Problem in loading the SAS date to Oracle table column

Posted in reply to deleted_user
Thanks Scott and Linus. It worked.

You are great!!
Super Contributor
Super Contributor
Posts: 3,174

Re: Problem in loading the SAS date to Oracle table column

Posted in reply to deleted_user
For the benefit of others, specifically, what was it that "worked" to solve your condition?

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Problem in loading the SAS date to Oracle table column

SASDATEFMT=(DBMS-date-col-1='SAS-date-format'
<... DBMS-date-col-n='SAS-date-format'>)

It is used if the SAS column date format does not match the date format of the corresponding DBMS column, convert the SAS date values to the appropriate DBMS date values

This option helped me getting the data in correct format in oracle table.

More examples of its usage are mentioned at http://support.sas.com/documentation/cdl/en/acreldb/61890/HTML/default/a001371624.htm.


Please let me know in need more clarification.
Ask a Question
Discussion stats
  • 5 replies
  • 1438 views
  • 0 likes
  • 3 in conversation