BookmarkSubscribeRSS Feed
dkb
Quartz | Level 8 dkb
Quartz | Level 8

Hello Community,

Environment: DI Studio 4.8, on a Unix platform

 

I'd like to create a user defined transform, or piece of user code, that checks the last modified date of an external file (so I can decide whether it should be reloaded). This is going to be used for multiple external files, so it needs to be generalised and neatly packaged, not a one-off bit of hardcoding.

 

If I have a physical file name, I can use FINFO to get what I need. 

 

But an external file can't be connected to the input of a user defined transform, and while it can be connected to the input of a user defined code transform, its name and physical location aren't then made available in macro variables to the code within. 

 

Any suggestions as to how I might get hold of the file name, or another approach to getting the last mod date?

 

Thanks,

Dave

1 REPLY 1
LinusH
Tourmaline | Level 20

Hi,

usually, for this kind of logic, I think it better belongs to your scheduling tool. Most of them have file events that can trigger jobs depening on things like arrival.

 

That said, I also recognize the (weird?) fact that the User Written Transformation doesn't accept External Files.

Using Pre-code to the File RFeade is to little avail since almos no useful macros are defined here, especially not the file name.

 

Allthough, the User Written Code might work. For some reason, you get a lot of automatic macros here. So one way to wrap it up is to write a mcaro that you stored in a SASAUTOS location (typically configdir/SASApp/SASEnvironment/SASMAcro.

Then you need to instruct your users to simply add a call to that macro in the User Written Code Transformatino that is linked to the External File Object.

Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 687 views
  • 0 likes
  • 2 in conversation