Monday, August 22, 2016

Summertime and The Writin’ is Easy


SAS Programming Professionals, 

Summertime and the writin’ is easy!  Clients are on vacation, managers are on vacation, users are on vacation, colleagues are on vacation, and the office is quiet.  Nice and quiet. Maybe just a little too quiet!

In many offices, there is a lull in the programming workload as people enjoy the warmer weather and head out for vacations, three-day weekends, and summer holidays.  The result of this happy exodus is fewer deadlines and less pressure on your work hours during the summer months.  So, what can you do when the programming workload diminishes?

You can outline and write the draft of a SAS technical paper for SAS Global Forum 2017; that’s what you can do!

The SAS Global Forum 2017 Call for Content is open between now and October 17th. 
http://www.sas.com/en_us/events/sas-global-forum/sas-global-forum-2017/program/sessions.html#call-for-content

Next year’s conference is actively looking for content in five formats:

  • Breakout Sessions – Get insights on the in-depth aspects of SAS software, including programming techniques, technical features, and innovative and practical applications. They can also be strategies and best practices about how to apply SAS to solve industry-specific challenges.
     
  • Hands-On Workshops – Get hands-on experience through a demonstration that you direct for 45 minutes. Hands-On Workshops (also known as HOW) are intended to help attendees learn how to use the features of SAS or JMP®.
     
  • Quick Tips – Perfect for beginners and experts alike to share quick tips and tricks, and useful nuggets of programming techniques that make jobs easier. A Quick Tip session should last 10 minutes or less and cover one concept in a concise and practical way
     
  • E-Posters – Here’s a perfect opportunity to present your solution or idea in a more relaxed environment and in a visually informative way. A greener alternative to traditional posters, e-posters allow you to transport digital posters in your pocket
     
  • Table Talks – Facilitated by one lead user in an informal, small-group conversational setting (max. of 20 participants), these sessions will not require a formal paper to be submitted. A limited number of sessions will be selected, and each may be offered multiple times.

Do you have an area of SAS expertise, a great programming methodology, or a clever SAS programming technique that you would like to write about and present?  If so, then compose a draft of the paper during the current programming lull and submit it to SAS Global Forum 2017.
 
If you have not previously submitted a SAS technical paper to a conference, then you may consider following steps: 

  • First determine if you have novel content to offer or a fresh perspective on doing something that is tried-and-true.  The best way to do this is to search previous conference papers to see if your topic has already been covered to excess.  Here is a link to previous years’ SAS Global Forum proceedings:  http://support.sas.com/events/sasglobalforum/previous/online.html
     
  • Thoroughly research your topic using SAS online documentation, previous conference papers, and other types of research papers that apply to your subject matter.  You want to make sure that your own paper covers the most up-to-date facets of the topic you are going to be presenting.
     
  • Create a draft of your paper.  Your draft should have the following sections:
     
    • Abstract – This is a concise paragraph or two that specify the programming “problem” and the solution your paper is presenting.
       
    • Introduction – This section provides a more detailed discussion about the programming problem and your solution.  It also introduces how the content of the body of the paper will be laid out.
       
    • Body of paper – This part is composed of multiple sections that provide the detailed explanations of your programming methodology, code, tip, etc.
       
    • Conclusion -- One or more paragraphs that summarize what has been discussed in the body of the paper.
       
    • Disclaimer – A standard boiler-plate disclaimer concerning the contents of your paper, SAS trademarks, and other trademarks must be included at the end of your paper.  See the author’s guidelines for the latest wording.
       
    • References – A list of references you used in researching your paper.   Your readers can access these references for additional information on the material presented.
       
    • Acknowledgements – A paragraph that thanks the people who helped you or who provided guidance during your research or writing of the paper.
       
    • Contact Information – Of course, you will want people to contact you either to heap praise upon the clever insightfulness of your paper or to ask questions.  So, provide an email address that they can use.
       
  • Submit your proposal to the conference by accessing this link:  http://www.contentet.com/SASGF2017/
     
  • Enjoy having put together a cogent treatment of a SAS topic and anticipate getting good news from the SAS Global Forum 2017 staff in October.

Okay, so the Call for Content does not actually require that an entire draft of your paper be submitted in order for it to be considered.  However, you should take advantage of this respite in your programming workload to get the research and writing heavy lifting done now.  You are not going to have the luxury of having so much time on your hands once the summer is over and everybody is back in their offices.
 
Summertime and the writin’ is easy!  That makes it a perfect time to outline, draft, and submit a paper to SAS Global Forum 2017.
 
Or, of course; you could just go to the beach!
 
Best of luck in all your SAS endeavors!
 
----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)
http://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90/ref=ntt_dp_epwbk_0

Monday, August 15, 2016

Hack 3.17 Maintaining Relative Order During PROC SORT

SAS Programming Professionals,

Did you know that you can maintain the relative order of observations in a BY group during a sort?  You can do so by using the EQUALS option on the PROC SORT statement. 

This concept is easier to illustrate than it is to describe, so let’s consider the SASHELP.CLASS data set that is already sorted by NAME.


We would like to have the data set sorted by SEX, but keep the NAMEs in alphabetical order within SEX.  So, we would code:

proc sort data=sashelp.class out=class equals;
by sex;
run;

…which nets the following:


Note that the resulting SAS data set is sorted by SEX and that the relative order of NAME (in alphabetical order) has been preserved.  The EQUALS option is handy for when you already have an established relative order within observations that you want to maintain after sorting by the variables in your BY statement.


Best of luck in all your SAS endeavors!

----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)

Excerpt from the book:  Did You Know That?  Essential Hacks for Clever SAS Programmers

I plan to post each and every one of the hacks in the book to social media on a weekly basis.  Please pass them along to colleagues who you know would benefit.

Friday, August 5, 2016

Hack 3.16 Keeping Track of SAS Data Set Updates with Audit Trails

SAS Programming Professionals,

Did you know that you can have SAS keep an audit trail of all of the updates made to a SAS data set? 

This is particularly handy if you need to determine who updated a SAS data set at any given time for a security review or a data integrity audit.  The audit trail file allows you to track when particular observations were added, modified, or deleted.  You may even be able to fashion your own update roll-back program from the audit file.

Creating an audit trail file for a SAS data set is easily done via the DATASETS Procedure.  Here is an example:

proc datasets library=cperm noprint;
      audit orsales;
      initiate;
run;
quit;

Executing the code, above, results in a SAS audit file named orsales.sas7baud being built in the CPERM SAS data library.  When updates are made to the orsales SAS data set, entries are made to the attendant orsales SAS audit file.

You can determine the variables available in your audit file by using PROC CONTENTS with the TYPE=AUDIT data set option.  Here is an example:

proc contents data=cperm.orsales(type=audit);
run;

The resulting Alphabetic List of Variables and Attributes looks like this:

Alphabetic List of Variables and Attributes
#
Variable
Type
Len
Format
Label
4
Product_Category
Char
25

Product Category
5
Product_Group
Char
25

Product Group
3
Product_Line
Char
20

Product Line
7
Profit
Num
8
12.2
Profit in USD
6
Quantity
Num
8
6.
Number of Items
2
Quarter
Char
6

Quarter
8
Total_Retail_Price
Num
8
12.2
Total Retail Price in USD
1
Year
Num
8
4.
Year
9
_ATDATETIME_
Num
8
DATETIME19.

14
_ATMESSAGE_
Char
8


10
_ATOBSNO_
Num
8


13
_ATOPCODE_
Char
2


11
_ATRETURNCODE_
Num
8


12
_ATUSERID_
Char
32




The variables beginning with _AT are the audit trail variables.  Two of the most important are _ATDATETIME_ and _ATUSERID_ which hold the date/time an observation was updated and the user ID of the person who updated the observation, respectively.

Once a SAS data set with an audit trail is updated, you can examine the specifics of the change by using PROC PRINT with the TYPE=AUDIT data set option:

proc print data=cperm.orsales(type=audit);
run;

You can use other SAS procedures, such as PROC REPORT and PROC SQL to print out the SAS audit file, too.

There is much, much more to discuss on this topic, and the SAS technical writers handle it with their usual thoroughness in the SAS online documentation on support.sas.com.  Check it out!

Best of luck in all your SAS endeavors!

----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)

Excerpt from the book:  Did You Know That?  Essential Hacks for Clever SAS Programmers

I plan to post each and every one of the hacks in the book to social media on a weekly basis.  Please pass them along to colleagues who you know would benefit.