Sunday, January 25, 2015

Are You Doing Things SAS Backwards?

SAS Programming Professionals,

Are you doing things SAS backwards?

Yea; we have all been there.  A manager, or a user, or a client, asks you to perform an analysis or create a data set and gives you a sketchy description of what they want. Maybe they say "It's like that report you did last November", or they send a few descriptive lines in an email, or they verbally describe it in a meeting, or they sketch out some ideas on a notepad.  So, you dutifully write a program that processes what you think is the relevant data and creates the result set you believe they want. You QC the results, present it to the requester and... you are told that it is not right.  So, you modify your program according to their feedback and create the next result set.  And, it is still not right.  You find yourself repeating the process again and again until your manager or user or client is finally satisfied.

What is wrong with this process is that you are starting to write a SAS program when you do not have solid specifications.  Not understanding exactly what the requester wants invariably leads to wasted programming time.  So, you need to get your user to be specific about what, exactly, s/he wants before you start programming.  At a minimum, the requester should define:

Input
  • The data sources you are to extract the data from
  • The selection criteria you are to use to subset the data
  • The variables they want in the final data set or report
Process
  • What types of analysis they want performed on the data
  • The formulas for any new variables that are to be created
  • Any transformations that are to be made to existing variables
  • What to do with missing values for important variables
  • Whether any variables should be suppressed from the final result set
Output
  • For data sets, the type of data set and the variable order
  • For reports, the layout of the report, including variable order, headings, titles, footnotes, and summary columns
  • For graphs, the type of graph, variables to be graphed, titles, legends, footnotes, and reference lines
  • The type of additional documentation needed, such as a PROC CONTENTS or frequencies of the delivery data set
The best thing you can do is to have your user send you the specifications in writing.  That performs two functions:  It makes the person stop and really think out what s/he wants, and it gives you a solid starting point.  From there, you can ask questions to fill in any of the details that were not covered in the original, written request.  After a few iterations, you should have a solid spec to work from.

If you only receive verbal directions or sketchy notes via email and are not likely to get anything more solid, you may have to write the specs yourself.  In that case, you would write down the details of the Input, Process, and Output steps that you believe your client wants and send them to the client.  Let your client review the specs and verify that they are what s/he wants, or suggest changes to your proposal that better define what is needed.  Once the email exchange culminates in fully ratified specs, you are good-to-go with starting the SAS programming.

Almost invariably, any programming effort--no matter how well spec-ed out--will require an iteration or two to satisfy a user's requirements.  However, you can drastically reduce the time you spend programming by nailing-down your user's needs as much as possible before you begin to write your SAS program.  Few things in life are more satisfying than creating a tight, elegant, efficient SAS program that conforms to specifications and that produces the requested result set.

Remember; without specifications to refer to, you cannot judge whether or not the program you wrote and the result sets you created conform to the requirements.  And, as Lewis Carol wrote:  "If you do not know where you are going, any road will lead you there."

Best of Luck in all of your SAS endeavors!

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






Monday, January 12, 2015

Did You Know That 15 Minutes Could Save You...? Yea, Everybody Knows That!

SAS Programming Professionals,


You would have to be a caveman to not be familiar with the "Did you know that 15 minutes could save you 15% or more on car insurance?" advertisement.  Multiple versions of the commercial are on television, on the radio, on the Internet, and likely on every other medium that has ever hosted that cute little gecko with the cheery British accent.


Well, the same sort of thing is true about SAS programming.  I would state it this way:

Did you know that studying SAS for 15 minutes a day could save you hours of programming time?
It is true.  Knowledge is power, and the more SAS knowledge you have the more powerful is your SAS programming prowess.

Some programmers are content to simply let their work tasks take them wherever they may lead, and to learn additional SAS programming hacks from solving the various software development problems that arise.  They hit a problem that cannot be solved with the SAS that they know, look up additional PROCS or functions, or options, or call routines, or SQL statements, etc. and use the new material to resolve the question at hand.  Fair enough!  On the job training is good, and it may make sense to let real-world problems dictate some component of your SAS acumen.
But, relying solely on a stimulus-response type of SAS learning is a bit short sighted.  A better way to increase your SAS knowledge is to be aggressive and actively study SAS.  That way, when you bump into a programming problem you have not previously experienced, you can reach into your in-memory SAS toolkit and pull out one of the SAS hacks that you have read about, but not yet had an opportunity to try.  You will already be familiar with the concept, so you will not need to spend much time coming up-to-speed on it.  Instead, you can customize the PROC, or ODS template, or hash, or... whatever to resolve the issue and go from there.
There are two things you need to implement this proactive approach to increasing your SAS knowledge:  fifteen minutes each day, and good material to study.
Fifteen minutes is only 1% of the 1,440 minutes available to you in a day.  So, it should be easy enough to find fifteen minutes to study SAS each day, right?  Well, that can be problematic for all of us.  We have so many work and personal commitments to attend to, that every moment of every day seems to already be scheduled with other things to do.  So, we need to get creative.  Perhaps you can take fifteen minutes on the subway or bus commute to work to read SAS material.  What about taking fifteen minutes the moment you get into your office before you begin reading emails?  How about using fifteen minutes of your lunchtime to read new SAS hacks?  Or, maybe fifteen minutes at bedtime.  Whatever time slot you decide upon, try to make it your own, inviolable, uninterruptable SAS study period each day of the week.  If becoming a stronger SAS programmer is important to you, you will find that elusive 1% of a day.
Regarding good material to study; there is a plethora of great SAS programming publications out there.  But, for "... studying SAS for 15 minutes a day ...", I recommend one of the SAS tips books.  Here are my recommendations:
Of course the first recommendation is my favorite because I am the author.  However, you absolutely cannot go wrong with any or all of the publications in my list.
So, did you know that studying SAS for 15 minutes a day could save you hours of programming time?
Well yea; everybody who read this blog knows that!
Best of luck in all your SAS endeavors!
----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)
Author page:  http://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90/ref=ntt_dp_epwbk_0

Thursday, January 1, 2015

Meet the New Year; Same as the Old Year...NOT!

SAS Programming Professionals,

Happy New Year to you, your families, and your colleagues!

This is the time of year when people make all types of New Year's resolutions.  According to the USA.Gov web site, the most popular resolutions are:
  1. Lose Weight
  2. Volunteer to Help Others
  3. Quit Smoking
  4. Get a Better Education
  5. Get a Better Job
  6. Save Money
  7. Get Fit
  8. Eat Healthy Food
  9. Manage Stress
  10. Manage Debt
  11. Take a Trip
  12. Reduce, Reuse, and Recycle
  13. Drink Less Alcohol
And, these resolutions all make sense because they promote personal growth.  It is a new year, so why not start making the changes that you want to carry forward throughout the year?

Along with personal changes, perhaps it is also time to consider what changes you could make to improve your SAS programming skills.  There is no "most popular list of SAS resolutions" for us to reference, so I will suggest some:

  1. Lose unnecessary variables and observations when inputting data sets
  2. Volunteer to help junior SAS programmers
  3. Quit writing programs without comments in them
  4. Get a better understanding of the intricacies of PROC SQL
  5. Get more sophisticated in your SAS Macro programming
  6. Save time by re-purposing your old programs
  7. Purchase some interesting SAS Press books... and read them
  8. Join a local SAS users group and attend meetings
  9. Get better at using the Output Delivery System
  10. Take a SAS class
  11. Write a technical paper for SAS Global Forum
  12. Reduce processing time by writing more efficient programs
  13. Subscribe to the SAS-L listserv
Hardly a comprehensive list, but definitely a good start, no?  And, I would bet that one or more of these resolutions resonate with you; that they are things you have been wanting to do, but have not quite found the time to work on in 2014.  Well, there are 364 more days of 2015 just waiting for you to dig into your own SAS resolutions.

Of course, you could simply sit back and do the same old, same old.  But, how could you continue to achieve personal growth as a SAS programming professional if you did that?

Meet the new year; same as the old year--Oh, we really think not!

Best of luck in all your SAS endeavors!

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

Tuesday, December 23, 2014

What's in Your (SAS) Wallet?

SAS Programming Professionals,


With tip of the hat to Capital One's famous ad campaign, I want to ask you:  What's in your SAS installation?


That is an important question because it is the key to knowing which SAS sub-products you can bring to bear on your organization's many business problems and analysis tasks.  Besides Base (Core) SAS, do you have SAS/GRAPH, or SAS/STAT, or SAS/OR, or SAS/IML, or SAS/Access Interface to PC File Formats installed on your workstation?  Do you have SAS products in addition to the aforementioned which you could exploit in certain circumstances to characterize corporate data and create result sets for your clients--be they internal or external clients?


Many SAS professionals think the best way to determine which SAS products are installed is to simply run PROC SETINIT, like this:


PROC SETINIT;
RUN;


Well, that is certainly a good start, but it does not give them the entire picture.  PROC SETINIT reveals all of the SAS products licensed for the platform it is running on.  It is possible that the SAS administrator did not actually install all of the products that are in the license on the computer.  If you did the SAS installation yourself, it is possible that you did not check off all of the available products when performing the install.  So, there may be a disparity between the number of products licensed and the number of products actually installed.


A better way to get this information is to run PROC PRODUCT_STATUS, like this:


PROC PRODUCT_STATUS;
RUN;


PROC PRODUCT_STATUS creates a very nifty report which specifies the SAS products installed on your computer as well as the maintenance level of each product.  The products listed in the log as a result of running this procedure are the only products that you can run with SAS on your computer.


If you are curious as to whether you have additional SAS products available on your license than are installed, run both PROC SETINIT and PROC PRODUCT_STATUS and then compare the two reports.  If you are not happy with what you see, have that long, serious talk with your SAS administrator and ask that the additional products you need be installed. 


Armed with PROC PRODUCT_STATUS, you will never come up short when somebody stops you in the hall and asks you: What's in your SAS installation?


Best  of luck in all your SAS endeavors!


----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)
Author page: http://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90/ref=ntt_dp_epwbk_0

Saturday, December 20, 2014

Was My Book One of the Top 5 SAS Books of 2014?

SAS Programming Professionals,


The final SAS Training & Book Report e-newsletter of 2014 arrived yesterday evening with a list of the top five SAS books of 2014. I was eager to see if my own SAS Press book, How To Become A Top SAS Programmer, was among the top five. Alas and alack, it was not.


However, I pleased to see that several books I regularly recommend to SAS programmers was on the list. The list is:


Top Five Books
  1. The Little SAS Book: A Primer, Fifth Edition
  2. Big Data Analytics: Turning Big Data Into Big Money
  3. SAS Certification Prep Guide: Base Programming for SAS®9, Third Edition
  4. SAS for Dummies, Second Edition
  5. Learning SAS by Example: A Programmer's Guide
Not having practical experience with crunching BIG DATA, I recommend that SAS professionals looking to build a comprehensive SAS documentation library seriously consider having books 1, 3, 4, and 5 on their bookshelves. You cannot go wrong with any or all of those publications.


Oh, and if you are serious about steering your SAS programming career towards better professional and financial growth, you cannot go wrong with my own book: How To Become A Top SAS Programmer.


Best of luck in all your SAS endeavors!


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


http://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90

Monday, December 15, 2014

Use This SAS Program to Measure the Benefits of Purchasing SAS Books


SAS Programming Professionals,

Did you know that you can objectively measure the worth of any SAS book you are considering purchasing by using a simple program that I developed?

After writing the print edition of my book, Did You Know That?  Essential Hacks for Clever SAS Programmers, I was inspired to share a program that SAS professionals can use to objectivey measure the worth of my book of SAS hacks.  The program uses US dollar$ as the unit of measure and weighs the monetary benefits of the hacks against the cost of the book against the income of the SAS programming professional.

The SAS program that follows is set up to evaluate the print edition of my book.  Change the SALARY, GOODTIPS, and TIMESAVED macro variables to evaluate whether Did You Know That?  Essential Hacks for SAS Programmers is right for y-o-u.

And, just as importantly, save this program so that you can modify the cost of the book and the book's title when evaluating any other book on SAS programming.

/*Michael A. Raithel's SAS Book Evaluation Program*/

%let SALARY=50000; /* Your yearly salary */
%let GOODTIPS=2;   /* Number of good tips that will save you time at work*/
%let TIMESAVED=15; /* Estimated number of mintes each tip will save you  */

Data tipworth;

length bigline $130;
label bigline = "Here are the points to consider:";

/* Perform complicated calculations */

Hourly_Salary = round(&SALARY/2080,.01);

Minute_Salary = round((Hourly_Salary / 60),.01);

Tot_Time_Saved = &GOODTIPS * &TIMESAVED;

Cost_Per_Tip = 9.95 / &GOODTIPS;

Total_Salary_Saved = Tot_Time_Saved * Minute_Salary;

Total_Net_Salary_Saved = (Tot_Time_Saved * Minute_Salary) - 9.95;

/* Generate a Spiffy Report */

bigline = "You found &GOODTIPS tips in the book to be useful for your job.";
output;
bigline = "You estimated that the useful tips in the book saved you &TIMESAVED minutes per tip.";
output;
bigline = "You make a handsome salary of $ &SALARY per year.";
output;
bigline = "So, your hourly salary is $" || Hourly_Salary || ".";
output;
bigline = "Which means you make $" || Minute_Salary || " per minute.";
output;
bigline = "Your cost per useful tip in the book was $" || Cost_Per_Tip || ".";
output;
bigline = "The total amount of salary you saved from using the tips was $" || Total_Salary_Saved || ".";
output;
bigline = "But, you must subtract the cost of the book ($9.95) to realize your true savings of $" || Total_Net_Salary_Saved || ".";

output;

run;

proc print data = tipworth noobs label;
var bigline;

Title1 "Analyzing the Merits of Purchasing";
Title2 "Michael A. Raithel's";
Title3 "New e-book:";
Title4 "Did You Know That?  Essential Hacks for Clever SAS Programmers";

Footnote1 "Amazon Print Edition:  https://tinyurl.com/y83aleb4";

Footnote2 "Other books by Michael A. Raithel: www.amazon.com";
run;

Best of luck in all of your SAS endeavors!


----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)
Amazon Author page:  https://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90/ref=ntt_dp_epwbk_0 

Sunday, December 7, 2014

Read SAS e-Books with Free Amazon Reader

SAS Programming Professionals,

Did you know that...

You do not have to actually own an Amazon Kindle to read SAS e-books purchased from the Amazon Kindle store?

The Kindle Store at www.amazon.com hosts 98 SAS e-books which you can surface by:

1. Selecting the Kindle Store in the search bar,

2. Typing "SAS Programming" in the search window, and

3. Clicking on "Go". 

So, there is a SAS e-book for most every interest. 

(Of course, I hope that you will be the most interested in my new book:  Did You Know That?  Essential Hacks for Clever SAS Programmers).

If you want one or more SAS e-books and either do not own a Kindle or find it too expensive, no worries!  You can download the free Kindle reading app to your PC, iPad, or mobile device.  Here is a link for downloading the Kindle reading app:  http://tinyurl.com/njehayz

When you download the reader, you are rewarded by complimentary copies of Treasure Island, Pride & Prejudice, and Aesop's Fables; all of which you can finally read without the pressure of having to do a high school book report on their main themes, the authors' use of symbolism, how they handle irony, and the motivations of the main characters.

The Kindle website boasts over 2-million e-books, but I am sure that you will be the most interested in the 98 books devoted to SAS programming.  So, save a tree or two and consider acquiring e-books instead of paper-based books.

Best of luck in all of your SAS endeavors!

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

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Amazon Author Page: http://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90/ref=ntt_dp_epwbk_0

Barnes & Noble Author Page: http://www.barnesandnoble.com/s/michael-raithel

Facebook Fan Page: https://www.facebook.com/MichaelRaithelAuthor

SAS Press Author Page: http://support.sas.com/publishing/authors/raithel.html

sasCommunity.org Page:  http://www.sascommunity.org/wiki/User:MMMMIIIIKKKKEEEE

Twitter:  https://twitter.com/MichaelRaithel
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++