BookmarkSubscribeRSS Feed
niespolo
Obsidian | Level 7

Hi,

I'm extracting data from an Oracle table and using SAS Data Integration Studio (DI).

The Oracle expression in the where condition is:

 

DATA_CARICAMENTO >= TRUNC(SYSDATE - 1, 'MI') AND DATA_CARICAMENTO <= SYSDATE

I would use an equivalent expression in the Extract transformation of DI.

 

DATA_CARICAMENTO's Format is Datetime20.

Do you know what's a correct expression I can use?

 

Thanks.

4 REPLIES 4
Kurt_Bremser
Super User

A little googling for "Oracle trunc function" revealed that this truncates the value to the minute.

So I guess that the low end for the comparison is the minute of 1 second past.

In SAS, that would be

today() * 86400 + intnx('minute',time()-1,0,'begin')

if I guess right.

LinusH
Tourmaline | Level 20

IMO an easier way to do it (and probably more effective) is to use tha autoamtic date/time variables.

"&SYSDATE:&SYSTIME"dt

&SYSTIME is in minutes, no need for trucation logic...

Data never sleeps
LinusH
Tourmaline | Level 20

Agree, but usually the Extract step is in the beginning of the session.

But in DI Studio, there's also automatic datetime macro variables created for you, so my final (?) suggestion would be to use ETLS_STARTTIME (or similar name, don't have DI Studio at my fingertips). 

Data never sleeps

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