Tag: SAS Enterprise Guide

Stored Processes: 3 Ways to Edit a Stored Process

Some may not realize that you can edit a SAS Stored Process in multiple ways (depending on your permissions).  Today I show you three different ways to reach the stored process code.  By the way, I’m using SAS Enterprise Guide 4.3 and SAS Management Console 9.3 – so your windows may look different. Method 1: SAS Enterprise Guide Many of you are aware of this method already.  Just for review – here’s how you open a stored process and then change it with SAS Enterprise Guide.  You have to be connected to the metadata server to reach the stored process. From the SAS Folders pane, select the SAS Folders icon. Navigate to the stored process location.  Right-click the stored process and select Add to Project.  The stored process appears in the Process Flow and Project Tree areas. From the Process Tree or the Project Flow area, right-click the stored process name and select Modify <stored process name>.  The Stored Process Manager window appears and you can make changes to your code.  I use this method most often because I like the help I get from SAS Enterprise Guide.   Method 2: SAS Management Console If you  have access to the […]

SAS Enterprise Guide: Pick a Winner Randomly

To pick the winners of the 50 Keys to Learning SAS Stored Processes book, my first thought was to print the list and then put everyone’s name in a hat. Angela brilliantly suggested that we use one of the SAS Random functions.  However, since there was a list  of names I really needed a random number between two values.  This brought to mind the MS Excel RANDBETWEEN function – but how do you translate that function to SAS Enterprise Guide code? Getting a Random Number between Two Values I have to admit for a one-off process like picking a random number,  MS Excel would be my goto tool. MS Excel has a function called RANDBETWEEN() that allows you to provide two numbers and it then selects a random value between those two numbers.  I tried to use the SAS RANDOM functions – but I couldn’t figure out how to make it work in 5 minutes (my personal patience meter) so I needed an expert.  Consult with a SAS Expert Lucky for me SAS-L had the answer – it’s one of the places I search for SAS tips when I’m stuck.  In August 2000, Mark Terjeson wrote a post called “Just […]

SAS Coding: 3 Data Set Tricks in PROC SQL

Maybe you are like me and your SAS programs frequently bounce from PROC SQL to data steps depending on the task at hand. Some things you cannot do in PROC SQL as easily as the data step and vice versa.  Here’s 3 data set tricks that I have successfully used with PROC SQL.  These are some time savers that you can use in your work.  However, if you know some others add them in the Comments section – I double-dare you.   Trick #1: Drop and Keep Options You can use the DROP and KEEP options on the FROM or CREATE statements. This is handy when you want to exclude or include a list of variables.  Consider this example where I saved myself some typing because I know the only variable I don’t want is country. Otherwise I would have had to type out all of the other variables just to exclude a single one. proc sql; create table Newtable  as    select * from sashelp.prdsal2(drop=country);quit;  Trick #2: Limit the Observations OBS allows you to control the number of observations input to the procedure.  I would use this if I had a particularly large data table and I just needed to test […]

SAS Enterprise Guide: Identifying Errors in the Log

In an earlier post, I provided a check log program that you could use with your batch jobs.  There was some really interesting discussions in the Comments about using SAS Enterprise Guide with the log.  Here’s some tips I have for working with the SAS Enterprise Guide logs – everything from some quick tips to changing the style.   Cruising the SAS EG Log When you run a program in SAS EG, if there are issues then a red x appears on the Program icon (1) and the Log pane (2) becomes the focus, as shown in the following figure.  When you log has error or warning messages, you can use the arrows (3) to move to the next or return to the last – this is convenient especially when the log stretches from here to Saturn’s inner most rings.  As you click the arrow – each error or warning message becomes the focus. Adding Some Swagger to Your Log Does your log lack umph? Lacking style?  Got no swagger?  Why not dress up the messages so they are identified a little easier?  From the Tools > Options window do the following: Select SAS Programs from the list.  The panel changes to the […]

Are 64-bit client applications twice as good as 32-bit applications?

In September 2010, I questioned whether you should care about native 64-bit client applications (or the lack thereof). At the time, SAS did not have a 64-bit version of SAS Enterprise Guide or SAS Add-In for Microsoft Office. A skeptical reader might assume that I was just trying to make […]

SAS Enterprise Guide: Check the Log Macro

I created a LogCheck macro [code provided] to review the log during a batch process. The SAS log files can be rather large and it is so much easier if you can just extract the issues in an easy to understand format. This macro reads in each line of the log file and keeps the ones with Error, Warning, Note, or specific text you want to trap.  Then it sends a colorful email to report what issues (if any) were found. You can download the code and two sample programs to review or change for your situation.  Let me know what you think in the Comments section.  How can the code be improved?  Any ideas you have?   Using the LogCheck Macro Add the LogCheck macro to your batch job to report issues through email about the job.  When the job has no errors, you will receive an email similar to the following.  The subject line indicates no found issues – thus you have some assurance the job was successful. When the job has errors – the macros sends an email similar to the following.  Notice the subject line contains the number of Errors, Warnings, and Notes present in the […]

Are you SAS Savvy?

Last week at Insurance and Finance User’s Group (IFSUG), I caught up with Sunil Gupta, a SAS Press author and a SAS expert. He was chairing one of the sections and presenting some information himself, which Angela Hall and Waynette Tubbs discussed in their blogs. However, Sunil is a busy man – the week before he was teaching a class about getting the most from PROC TABULATE in a live lecture from his SAS Savvy site. Touring SAS Savvy If you are just learning BASE SAS or SAS Enterprise Guide, then SAS Savvy should be a part of your weekly rotation. This site is a well-organized collection of original material and thoughtful links to other SAS resources. In addition, each month, Sunil hosts a live SAS Training session, giving you direct access to a leading SAS expert! Frequently Updated Savvy Content For the training sessions, Sunil uses a desktop sharing program and a voice conference. For the PROC TABULATE class, two others joined the session, so it was easy to ask questions and not feel like you were getting lost in the crowd. Sunil commented that after learning PROC TABULATE, he had stopped using PROC FREQ and PROC MEANS because […]