How we love shortcuts. Our life seems more efficient with them. I try to take the earlier train for a good parking spot that lets me exit early. Actually change that to any spot (my train station has tons of commuters with FEW parking spaces so getting up early is the only choice). But some of these shortcuts come at a cost. Remind me to tell you all about this Natural Law that SAS also respects in a future post.
Don’t we all try to recreate our world with a bare minimum of manual work? Our perfect world would have machines do all our bidding and our repetitive manual work leaving us completely free to dream up better and faster technology and solutions. While you revel and enjoy this dream for a few seconds, allow me to bring you gently back to reality with three practical tips to help you do just that. I use these, time and over again to help manage my SAS display manager session.
Shortcut #1 - Check the log first
You’re probably familiar with the theme song you’ve heard in a SAS training class “Always check the log first.” Well, isn’t it possible to let SAS make the log its window of first choice instead of hitting all those keystrokes to get to the log? Absolutely! Here’s what you do:
- Make the log window your active window.
- Type this code into your command window and hit enter.
Autopop on; wsave;
Now run a SAS program, any SAS program. See how it takes you directly to the log without you having to activate the log window?
Shortcut #2 - Clear log, output & submit code in one keystroke
Fast on the heels of my last tip is the question that’s probably on the tip of your tongue: But the log is a chronological log, sometimes I want to see my entire log history. Other times I just want to see the most recent log and output. How? With these steps:
- Activate your function keys by typing Keys in your command window.
- Find a function that hasn't been programmed yet. I'll pick F12.
- Type in this command:
Clear Log; Clear Output; Submit;
Now run any program by hitting the F12 key or whichever key you used as your shortcut for this tip. See how it automatically clears your log, output windows and submits your SAS program all in one masterful keystroke! Needless to say you don’t have to use this programmed key when you want to see the log and output accumulated.
Shortcut #3 - Automatically assign libraries at startup
Library assignments can be a drag sometimes. All you want is for your libraries to be automatically assigned in your session. Can you let SAS do this? Sure, here’s how (FYI, I’m suggesting an interactive method here but if you prefer writing code, you can certainly embed multiple Libname statements in your programs to assign them at startup or even include them in your autoexec.sas program file).
- Click on the New Library icon.
- Enter the library name and path.
- Check Enable at startup.
Next time you open your SAS session, you’ll see the ORIN library is automatically assigned without any manual interference.
Hope you found these tips useful. I always share them with students who take my SAS programming classes. I’m sure you have many more that you use. I’d love to hear your tips and also what you’d like to read about in my blog posts. Do you like them short or long? Looking forward to your ideas.
9 Comments
Pingback: Top 10 SAS coding efficiencies | The SAS Training Post
Pingback: Priyanka Chopra
Pingback: URL
thanks all for your comments. Glad you found this post useful. Chris, checked out your CheckLog macro. Cool! Lori, have you maybe tried putting all your libname statements in the autoexec.sas file that runs automatically at your sas session startup. Thanks for reading & writing in!
Hi Charu,
This is a great post. Thank you.
I thought it might be able to be expanded upon in a future posting to explore the default KEY settings and how we can employ these to optimal advantage. For example, how would we use F8 ?
Or how we can set up more complicated libnames at start up? I'm thinking specifically of a libname connection to an Oracle database
While you're at it, you can download my CheckLog macro, save it in an autocall library, and assign it to a keyboard shortcut. I use SHF+F6 since F6 is the shortcut for the log window. Once you're program is done, you can not only review the log yourself, but have CheckLog do a review for you too.
Nice job Charu!
Hi Charu,I already use the 2nd n 3rd tip and yeah it does help a LOT and saves so much time...thanks for the precious time saving tips !!
Cheers
this is really nice. Please keep up this good work..Thanks a lot.