SAS gets your attention with a text message!

This post was kindly contributed by Key Happenings at support.sas.com - go there to comment and to read the full post.

Contributed by Scott Vodicka, a member of the SAS Global Consulting Business Intelligence Practice

An interesting topic came up the other day in one of my email conversations. What was the topic of the email? Well, I am glad you asked. It was how do we send text messages from SAS to someone’s cell phone?

It is so easy that you will not even believe it! As a lot of us know SAS supports sending emails from a data step program, and the publish and subscribe model supports delivering information via email. The quick answer is to use the email address of the person’s phone in the TO: field for the data step, or the email address used to subscribe to a channel.

So, now that the easy part is done, let me give you some information that will help you solve the problem I know you are now facing: How do I determine the users email address for their phone? There are a couple of tricks that make this really easy.

Below is a short list of popular carriers with their associated domains:
  AT&T:          @txt.att.net
  Alltel:           @message.alltel.com
  Sprint:           @messaging.sprintpcs.com
  T-Mobile:         @tmomail.net
  Verizon:          @vtext.com
  Virgin Mobile:     @vmobl.com

Check out these web sites for updated information on carriers, especially since this sector is constantly in flux.

If your phone number is: (919) 555-1234 (not a valid number), and your carrier is AT&T then the email address for your phone is: 9195551234@txt.att.net

Another way to find out your phone’s address is to send a text message from your phone to your SAS email account: and you’ll get the email address for your phone in the from field (it might go to your junk folder).

Here is a sample data step program that sends an alert as a text message to a user’s cell phone. Before you submit the program below be sure to update your SAS configuration file for the following options:
EMAILSYS  EMAILHOST  EMAILID  

You may have to supply the EMAILPW value depending on how your SMTP server is configured. You may specify the EMAILID and EMAILPW values in your SAS program via an options statement. See SAS documentation for details.

%let email_alert="9195551234@txt.att.net";
%let email_from="SAS Monitoring System ";

%let errormsg=Server failed to start;
%let host=metadata_server;

filename em_out email to=(&email_alert) from=(&email_from)
    subject="Alert: SAS 9.2 Critical Status Error";
data _null_;
  file em_out;
  format timechar $21.;
  timechar=put(datetime(),datetime21.2);
  put timechar "ERROR : &sysuserid.@&host - &errormsg..";
run;

Important Note: Many people are charged per text message. Be sure to get permission before sending a text message to an individual.

This post was kindly contributed by Key Happenings at support.sas.com - go there to comment and to read the full post.