We’re smarter together. Learn from this collection of community knowledge and add your expertise.

How to get started with SAS University Edition - Part 4

by Super Contributor on ‎02-21-2015 11:33 AM - edited on ‎10-05-2015 03:12 PM by Community Manager (1,348 Views)

My previous posts on the Introduction, Basics and Tasks within SAS University Edition (SAS UE) covered the preliminary features of the program.  In this series of articles, we’re going to dig into some pretty intense topics – but I promise I’ll go slow and provide plenty of screen shots and work through different examples when appropriate.


Interactive Mode

I admit, I was a little stumped when I first saw this button on the toolbar (InteractiveMode_1a.png) – clicking it and then running code didn’t seem to have any effect.  I then decided that I should take my own advice and read the documentation – and was thrilled with what I learnt.  In a real-life example, when I am writing new code that has multiple steps within a single PROC, I will break out the individual steps and validate them after every step – this way I know that the data being passed from one step to the next is validated and accurate.  The problem with this is that it makes for messy code, which I then have to go back in and modify so that all the PROC syntax is in a single step.

As an example, here is what new code I’ve written looks like.



This is what I want my code to look like after I’m finished.




If my code is extremely complex, validating and cleaning it can be time consuming and I may miss a problem or accidentally delete something.  SAS UE’s “Go Interactive” mode saves me from this. When I go into Interactive Mode, I can highlight a piece of code and it will run, as in the screenshots below.





When I highlight and run the third line of SQL and include the QUIT;, the code executes, generates the output, and the log looks like this:



Talk about an easy way to debug and test your code!


Running non-SQL code (for example, scatter x=height y=weight;) generates the standard syntax error ERROR 180-322: Statement is not valid or it is used out of proper order.


One word of caution when working with Interactive Mode – any errors will persist throughout until a logical endpoint.  For example, if you have an opening ‘ but no closing ‘, SAS University Edition will continue to consider everything after the first ‘ as part of the string until either a second ‘ is encountered or SAS runs into a string overflow.   This is different from “normal” SAS, where each submission is a separate entity so if you make an error, it will be contained within that particular PROC or DATA step.


Submission History

How many times have you run SAS code, made a pile of changes, and then realize you wanted the original version (either for validating, data mining, etc.)?  Imagine if there was an easy way to get this previous version back without having to hit CTRL-Z any number of times. Submission History allows you this to be easily accomplished.


Here’s my SAS code; the first version I ran was the same three lines as in the Interactive example (note: Interactive Mode must be turned off).  I added the HEIGHT criteria, and then re-ran the code.




When I click the Submission History button (InteractiveMode_SubHistoryButton.png) I get the drop down menu as below.




When I click on the earlier of the two timestamps, a new tab opens (with the same name as the program I’m in with (1) at the end).   You’ll see that the code in the window was the first iteration of my code.  I can now copy it and paste it into a new window, save it as a new file, or close it and carry on.




The Submission History button, along with the Interactive Mode feature, are going to assist me in becoming a more efficient and effective SAS programmer by allowing me to test, review, and revise my code faster than I’ve been able to do previously.


Tomorrow’s post will be the various Graph Tasks available, which I am very excited to write about.




This is article #4 in a six-part series. Links to all of them are below:


Your turn
Sign In!

Want to write an article? Sign in with your profile.

Looking for the Ask the Expert series? Find it in its new home: communities.sas.com/askexpert.