This week's SAS tip is from Phil Mason and his ever-popular book In the Know...SAS Tips and Techniques From Around the Globe, Second Edition. In a review, SAS user Ian Whitlock said "Phil Mason is the grand master in the art of the SAS software tip." It was definitely difficult picking just one excerpt to feature this week!
The following excerpt is from SAS Press author Phil Mason and his book "In the Know...SAS Tips and Techniques From Around the Globe, Second Edition." Copyright © 2006, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software)
If you like this post, take a look at previously featured tips from Phil Mason: Useful secret options and Saving Graphs without ODS. You can also view a free chapter from Phil's book.
Good one Phil. I think rarely used but can be very useful.
Another use is the opposite of the one you give: use it while testing so you can analyze your intermediate datasets after the job has run results while sending tjem to the bin in production.
It also illustrates that is is a good habit to always explicitly code WORK. prefixed to your dataset references if you that's where you want them to always end up. This shields you from unwanted and unexpected side effects when someone else uses your code in the context of the USER option. WORK is but a default that can be deviated from. Take the generated code from DI Studio as an example. They never leave it out.
you make a very good point. It is good practice to do as you say. There's another chapter that I should add to my next book "Best Practice techniques in SAS programming".
I suppose I would point out that my tip does have some advantage though. If you do code all the "work." references, then you cant use the USER libref as I suggest. I have found this quite useful to use in my career. Especially when developing with stored processes so that I could direct the work dataset to a location that I could easily access to try to work out why some exceptionally tricky code was not working.
thanks for your comment.
Phil (writing from a wet and windy place near Oxford, England)