The data management black box--SAS® Job Monitor

SAS log with red X

No more combing through SAS log files.

Solving the mystery of Malaysia Airlines Flight 370 hinges on the finding the plane's black boxes, or flight data and cockpit voice recorder. An airplane’s black box is something we hope never has to be used, but when there’s a problem, we sure are glad that it’s there. The black box holds incredibly valuable data about the aircraft, crew and flight details and transmits locator beacon signals that tell us where the missing plane is and, if recovered, can shed light on what went wrong.

SAS® Data Management has its own black box of sorts, called SAS® Job Monitor, which shows underlying data from jobs and processes. It was developed to help users quickly and easily pinpoint the source of errors should they encounter a hiccup while running SAS jobs and processes. Read More »

Post a Comment

Don’t miss these calls-for-participation deadlines

The call for papers is open for all 2014 US regional users conferences.  A few deadlines are just around the corner, and you won’t want to miss them!

WUSS 2014 – May 5

SESUG 2014 — May 19

MWSUG 2014 — June 13

SCSUG 2014 — June 30

Spring is a difficult time of year for deadlines. So with all the distractions of taxes, new gardens and spring break, why should you take time to write up your great idea for a presentation, tip, poster or how-to session?  Here are three good reasons:

The regional conferences leaders will be publishing other deadlines and updates throughout the year.  You’ll want to watch these publications so you don’t miss a thing about your favorite regional SAS users conference:

Post a Comment

Make your macro invocations data driven!

Some very common questions we receive into Technical Support are, “I need to be able to send the data for every hospital listed in my data set to a separate .csv file. How can I do that?” Or, “How can I run a PROC REPORT for each region listed in my data set?” And, “How can I send an email to each manager listed in my data set?”

Each one of these questions has something in common. Each question is asking how to execute a task based on a data set variable. Within SAS, the best way to execute a repetitive task is to use the SAS Macro language. The best way to invoke a macro based on a data set variable is to use CALL EXECUTE. The two most important aspects of CALL EXECUTE are that it allows you to:

  • conditionally execute a macro based on DATA step logic
  • pass in a data set variable’s value in as the value to a macro parameter

Two common errors when invoking macro statements based on DATA step logic
Because CALL EXECUTE is a DATA step call routine, it can be conditionally executed using DATA step logic. It is important to understand the basic timing of a macro statement. A macro statement executes a DATA step at compile time. This means that macro code executes before any DATA step logic is ever evaluated. Here is an example of logic that will not work. Because of the timing of macro statements, this macro invocation will always execute, regardless of the IF condition. CALL EXECUTE can be used to accommodate for this difference in timing.

If first.hospital_id then do;

The above example also illustrates another common mistake when attempting to invoke a macro based on DATA step logic. This example is attempting to pass in the value of the data set variable HOSPITAL_ID as the parameter to the macro. It is important to know that the macro language is simply a text language. When the MYMACRO macro executes, the text ‘hospital_id’ is passed in as the value of the macro parameter, not the value of the data set variable HOSPITAL_ID. Again the desired result can be achieved using CALL EXECUTE.

How to invoke a macro using CALL EXECUTE
So now let’s see the correct way to invoke the macro using CALL EXECUTE. In the following example, we are going to dynamically create a .csv file for each hospital listed in our data set. This will be accomplished by placing a PROC EXPORT within a macro. CALL EXECUTE will allow to invoke the macro for each hospital listed in the HOSPITALS data set.

/* sample data set that contains the hospital ids */ 
data hospitals;                                                
  input hospital_id $ quarter number_of_patients;                               
A100 1 125                                    
A100 2 115                                                                                                                              
A100 3 130                                                                                                                              
A100 4 110                                                                                                                              
A200 1 200                                                                        
A200 2 195 
A200 3 180                                                        
A200 4 190                                       

/* this macro uses PROC EXPORT to write data to a .csv file */

%macro mymacro(hosp_id);                                                                                                                

proc export data=hospitals(where=(hospital_id="&hosp_id"))                                                                                  


data _null_;                                                                                                                            
  set hospitals;                                                                                                                        
  by hospital_id;

/* this logic allows us to call the MYMACRO macro 
each time the value of HOSPITAL_ID changes */   

  if first.hospital_id then do;
    call execute(cats('%mymacro(',hospital_id,');')); 

This logic will work regardless of the number of hospitals listed and of the number of quarters listed for each hospital. When this code is executed, the following macro invocations are generated.

First time the IF condition is true:
Second time IF condition is true:

How the CALL EXECUTE routine processes macros
It is important to know what happens behind the scenes when using CALL EXECUTE. When the argument to CALL EXECUTE is a macro invocation, the macro will execute immediately. This means that all macro statements are executed and all macro variable references are resolved. All non-macro code generated by the macro is stored and does not execute until after the step boundary that terminates the DATA step that contains the CALL EXECUTE is encountered. The timing of when statements are executed can sometimes lead to unresolved macro variables, which in turn can lead to unexpected syntax errors. This issue is discussed in detail in SAS Usage Note 23134. The note discusses the cause of the potential problem as well as the solution.

CALL EXECUTE is an invaluable tool that should be added to your macro programming toolbox. CALL EXECUTE allows you to make your macro invocations data driven, which can make your programming more efficient and adaptable.

Post a Comment

6 great ideas from SAS users group leaders

sas_user_conferences_verysmallThe SAS Users Groups Leaders meet-up was scheduled for the last evening of SAS Global Forum 2014, sandwiched between the last of the Tuesday presentations and the Kick-Back Party later that evening. There were a few familiar faces from regional users groups but lots of new ones from local and in-house groups. In fact, the meeting room was nearly standing room only!

SAS coordinators Nancy Moser and Sue Leitch each took the opportunity to reiterate the value and importance of SAS users groups and to remind us that SAS users groups are unique in the software industry. Each SAS user event, like the recording-breaking international conference in Washington, DC, is planned and organized by volunteers. That why meet-ups like those at SAS Global Forum 2014 are especially important as an opportunity for leaders to meet and learn from each other.

The big questions that night were how to find speakers and how to get new users--especially younger users—involved. New in-house and local SAS users groups are popping up daily and the regionals have opened their calls for participation, so I thought this would be a good time to share these tried-and-true ideas from experienced SAS users group leaders. Read More »

Post a Comment

Seeing SAS Administrators in their natural habitat

It was wonderful to see and talk with so many SAS Administrators at SAS Global Forum this year. If you’re like me, you may have finished the conference wondering why it wasn’t possible to be two places at once because there was so much terrific content that it was impossible to see it all.

I haven’t yet figured out how to be two places at once, but I have compiled a list of some of the great SAS Global Forum 2014 papers that are especially relevant for SAS Admins. Based on conversations with many of you and with the questions we received during the SAS Administrators Panel Discussion, I recommend the following list: Read More »

Post a Comment

SAS Global Forum: 3 essential tips for students

Technology and software, much like SAS, makes everything simpler and more accessible. To fully appreciate what a company like SAS embodies and what it has to offer a student, I feel it is essential to attend SAS Global Forum, especially if analytics is something that drives you. Attending a conference this diverse and of this caliber can be a great opportunity to learn and meet others in the same field of study and industry.

Attending as a student can, however, be a bit overwhelming, even though it is a great way to motivate yourself and get your innovative ideas flowing. Based on my experience at SAS Global Forum 2014 in Washington, DC, I wrote this simple guide for students who wish to attend a future SAS Global Forum conference: Read More »

Post a Comment

Home from SAS Global Forum--what next?

You’d think life would be calmer after the high energy of SAS Global Forum. Not so here at SAS! Your feedback is THE most crucial element of the conference for SAS teams, and we’ll be spending the next few weeks digesting it, choosing the best method for implementing it and finally getting your suggestions ready for release.

What will you be doing with all that great conference content now that you’re back in the office?

Post-conference follow-up is just as important as the conference itself, maybe even more so in today’s economy. Your organization saw the value in sending you to SAS Global Forum 2014. In return, what’s the best way to ensure that you and your organization will get the most out of that investment?  I’ve done a little research and pulled together a few tips on what to do now that you're home from SAS Global Forum (or any SAS users conference): Read More »

Post a Comment

Test results show SAS performs admirably with flash storage from Fusion-io®

SAS is constantly evaluating new technologies for internal and customer experiences. Based on requests from many of our customers, SAS R&D engaged with Fusion-io® to do performance testing with Fusion-io® ION™ Accelerator and ioScale™ storage devices. Our testing goals for the testing included: Read More »

Post a Comment

SAS Global Forum 2015—start your journey today

Hello, I’m Dr. Tyler Smith, your SAS Global Forum 2015 conference chair.

SAS Global Forum 2014 ended a few short days ago. What a wonderful conference—a breath-taking venue, record-breaking registration and exciting announcements from SAS for the Academic Community.

SAS Global Forum is the premier worldwide event for SAS professionals. Every year since 1976, the conference brings together the best and brightest SAS users and experts. It’s always focused on giving you the ultimate conference experience by offering the best quality and most relevant content possible – and, of  course, ensuring you have fun doing it. After all, as I tell my children, we are in a rare field where we are paid to solve puzzles! That same sense of fun and spirit of discovery has really come in handy as we’ve worked to shape the 2015 conference. Read More »

Post a Comment