First, let me start by saying that I am new to the SAS world. So, it is possible that I am overlooking the obvious. 🙂
Essentially, I have a DI Studio job that includes 2 controls: User Written; Return Code Check. Everything is working as expected. On the Return Code Check, I am checking the status of my job, and sending emails on "Error" and "Successful". I have 2 environments: DEV; PROD. My jobs are setup and running in both environments. Thus, when I get the emails, it is hard to determine which environment the email is from. So, I would like to include the HOSTNAME in the email (I could use Outlook rules to key on this and do things for Errors). Obviously, I can hardcode the host into the email, which is exactly what I am current doing. My email for "Error" currently looks something like this:
SASPROD -> Error: &etls_jobName (&jobID); TRANS_RD = &trans_rc
This becomes a problem when I promote a new (or updated) job from DEV to PROD, as I always have to remember to modify the Status Handling on each job...updating the HOSTNAME. I have attempted to use &HOSTNAME, but that throws an error. I would like to automatically include the HOSTNAME, server name, or something, that will automatically indicate which environment the message is from.
Any ideas?
Thanks for your time and help,
Ricky
You could try automatic macro variable &syshostname.
You could try automatic macro variable &syshostname.
THANK YOU!!! That is exactly what I was looking for. I tried searching for everything and could not find this. So, is there a list of these automatic macro variables that you can point me to? Also, in User Written code, is there a preference as to whether you use these automatic macros variables v.s. global environment variables?
Again, thanks for your help,
Ricky
When you issue
%put _all_;
you get a listing of all currently defined macro variables; this is handy when you're looking for something.
Automatic macro variables are more or less platform-independent, while using %sysget() to utilize OS environment variables might give you additional information that SAS doesn't/can't provide.
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.
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.