BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rgreen33
Pyrite | Level 9

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

1 ACCEPTED SOLUTION
4 REPLIES 4
rgreen33
Pyrite | Level 9

@Kurt_Bremser,

 

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

Kurt_Bremser
Super User

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.

rgreen33
Pyrite | Level 9

@Kurt_Bremser,

 

This is great stuff!  Thanks for your help.  Much appreciated.

 

Thanks,

Ricky

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 1749 views
  • 3 likes
  • 2 in conversation