SAS Procedures

Help using Base SAS procedures
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3736 views
  • 0 likes
  • 3 in conversation