BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
5 REPLIES 5
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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
deleted_user
Not applicable
Thanks Scott and Linus. It worked.

You are great!!
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
For the benefit of others, specifically, what was it that "worked" to solve your condition?

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
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.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 3387 views
  • 0 likes
  • 3 in conversation