Hello,
We have many SAS programs in our Data Warehouse and some of those contains hard coded email addresses of employees that are not working anymore for the company or have changed of department and so on.
Does someone has already encountered this issue and if so, what’s the best strategy to have low maintenance on our programs.
I have though about the use of AD group but may be there is other solutions.
Please, feel free to share your idea.
Regards,
In my experience, not all users in such a global list would need notifications from all programs, it's rather that certain users want notifications of success for a given job, while others would need notification of failure (unless you can handle this globally from the scheduler). So the one controlling the flow of all batch jobs has decisions to make that can't be made purely from a department/position POV, and those decisions cannot be handled through programmable logic without serious effort. And whenever you think you've got a system that handles it all, you are notified by reality that it ain't so.
Handle that personally, and use the dataset I mentioned to find people who moved or are no longer available. But that's just my $0.02
What is the purpose of the hard coded email? To provide a contact point for troubles with the program? Replace all the myriad email addresses with one generic forever address like problemcontact@mycompany.com.
Create an email group that contains all of the email addresses you currently want to send to. Then in your SAS programs, reference the email group not individual email addresses - it could be something like MySASEmailGroup@MyCompany.com. Talk to your email administrator to find out about this.
Maintenance is then as simple as changing the members in the email group. No code changes are required.
Also if you wish to email based on whether a scheduled SAS job has successfully completed or failed, then do that in your job scheduler and not in code at all.
These email addresses are DATA, so they have no place in CODE.
Set up a dataset that contains email addresses and program names in which they are used. You can then use this dataset to check for validity, and the programs can pick "their" emails from it.
Hello Kurt,
I agree with you that email addresses should not be in the code.
Almost all of the programs were developed before my arrival.
I find your idea interesting however, it is the SAS administrator
who will have to maintain this dataset.
Is there a way to use windows active directory?
Another department would take care of the update.
In my experience, not all users in such a global list would need notifications from all programs, it's rather that certain users want notifications of success for a given job, while others would need notification of failure (unless you can handle this globally from the scheduler). So the one controlling the flow of all batch jobs has decisions to make that can't be made purely from a department/position POV, and those decisions cannot be handled through programmable logic without serious effort. And whenever you think you've got a system that handles it all, you are notified by reality that it ain't so.
Handle that personally, and use the dataset I mentioned to find people who moved or are no longer available. But that's just my $0.02
We always keep this info in a text file, specifically JSON. Keep metadata in a simple file and read it in at the beginning.
AD groups are good as is mailing groups. That said, oftentimes there is a hassle with someone else having to do the changes for you (Exchange team, for example).
I primarily use C# these days and it binds directly to JSON. In SAS, use the JSON libname engine and keep the structure simple so it goes directly into a dataset. You can also use XML but it is pretty wordy. I don't believe SAS supports YAML as of yet in Base. It has YAML support in Viya.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.