Here is a quick tip for keeping the WORK library clean in a UNIX/Linux environment. Most of the time SAS manages the cleanup process very well but sometimes orphaned processes can leave unwanted data lying around which can build up over time. This tip is only applicable for UNIX or Linux environments. Windows would have a similar approach with different commands. Use a Shell Script for UNIX Heavy Lifting This simple shell script will find all WORK directories created by SAS sessions and recursively remove everything within each directory older than a set time frame. The joys of shell scripting! WORK=/sas/work#!/bin/sh find $WORK/ -mtime +3 -type f -exec rm -rf {} \; exit 0 The WORK variable is set to the physical path of the WORK library on the compute server. The number 3 represents the number of days since the file was last modified. When this script is run, it initiates the find command which finds everything starting from the set directory with a last modified date older than 3 days, then forcibly removes everything within. To prevent any permission problems, it should be run as ‘root’ or any other super user. Why Not Schedule It? This shell […]
Tag: coding
SAS Global Forum 2012: Will I See You There?
Check out the results of my SAS Enterprise Guide code – 41 days til SAS Global Forum 2012 in Orlando, Florida! I’m excited – I can’t wait to meet some of my Web friends face-to-face finally! Oh and also catch up with some of my old buddies! Why Should I Attend SAS Global Forum? Here’s the reasons I like to attend: Like Minded PeopleWorking in smaller organizations, I was sometimes was one of a handful of data geeks running loose in the halls. It’s great to meet 3,000+ others who actually know what “code or let SAS EG do it?” means. The SAS users are one of the things that make this a great product to use. There are several meetups planned (think it use to be called Birds of a Feather) – I want to check out the joint SAS-L, SASCommunity, and SAS Discussion meetup. Plus after you arrive there are others – for instance, new SAS users, SAS BI users, etc. Oh and the .. Kick Back Party … you know you want to show off all your groovy dance moves! Don’t worry I’ll have my camera! Exchange of IdeasEach time I attend – I come away with […]
SAS Enterprise Guide: Cut and Paste Excel Data into SAS Dataset
Yes, you can import a spreadsheet into SAS Enterprise Guide and it’s super simple. However, there are times when I have been building datasets from several pieces of data. Come into my lab … now that I’m a data scientist! Careful, don’t knock over any of my beakers or touch my experiments – you might cause an explosion. Create the Framework To build your new dataset just decide how you want it to look – how many columns, what they will hold, and so on. Here’s how you do it in SAS Enterprise Guide: Go to the File > New > Data. A New Data window appears. In the Name field, type the name of your new dataset and then select the library you want it in. This needs to be a local library unless you have permissions to create a dataset in the metadata library. [A completely different subject … ] The next window allows you to create the columns. You can edit Column Properties to change the name, label, format, informat, and length. You can add and delete columns. Obviously – you can be your own little wizard and conjure up the dataset of your dreams! Now for Some Excel Tricks […]
Enterprise Guide: Zero My Hero – Using the Z Format
Working with account numbers can require adding a leading zero. You can use the Z format but it can be a little tricky. Not so long ago I showed you how to use the Z format to create a new data item in Information Map Studio. However, I noticed many people are still searching for this information and when I was using it myself I was not able to find much on it. This post explains how to create a new column in Enterprise Guide following by the actual coding steps in PROC SQL: Creating a New Column in SAS Enterprise Guide Query Builder To add the leading zeros, you have to use the Z format and a numeric variable. Using the Query Builder, you can create a new column in your data. In this example, you’ll see how to change the numeric ACCNO to a character variable with the leading zeros. This example starts with the ACCNO_TWO dataset. To create the new column, do this: From SAS Enterprise Guide, open the Query Builder with the ACCNO_TWO dataset. Select Computer Columns button. In the Computer Columns window, select the New button (not shown). From the New Computed Column window, select […]
Peek Inside SAS BI Book: Building Business Intelligence with SAS
You may be aware by now, our new SAS BI book Building Business Intelligence with SAS:Content Development Examples launched last week on the SAS Press site. That’s right, SAS Press or Amazon will be delighted to bring a copy of this SAS BI book to your door. When Angela and I set out to write this book, one of the first things we discussed was how new users get access to the SAS BI toolset and have no idea of its astonishing capabilities. This book guides you through each one so you understand it. Intermediate and advanced users will also find this book as a valuable reference. Several times, Angela & I have both found ourselves pulling out the draft copy to reference an advanced technique. This book fulfills a unique spot in the marketplace; there is no other single book that leads you through each SAS BI component with step-by-step examples along with hundreds of tips and techniques to make you successful! SAS Institute offers over nine SAS BI courses to cover all the topics we have jammed packed into this book. Making this an excellent study guide for those planning to take the SAS BI Content Development Exam. Your SAS […]
Android/WebOS Apps for Quick SAS Reference
I’m delighted that Phil Holland, Holland Numerics, has written a guest post today. Phil, clearly a SAS icon, is the author of numerous SAS books that are available from multiple sources. He recently expanded his work into some new and exciting formats, which he is discussing in this post. Writing SAS Books Let me be very clear about my attitude to writing books. I am never going to sell enough of my SAS books to compete with J K Rowling. I write books purely to market my SAS skills, and I’m never going to earn enough from selling books that will allow me to retire early, even if I wanted to! I discovered over the last few years that there are a lot of illegal copies of both my two previous books, and I mean a lot! Part of me is flattered by the proliferation of my books, and another part of me is offended by the criminal acts of illegally copying MY BOOKS! It appears that several people have obtained (bought?) paper copies of my books, scanned them and distributed the scanned copies on Torrent sites. I’ve informed SAS Publishing of these Torrent sites, but it is futile to […]
SAS BI Dashboard: Google Analytics Dashboard Kicked Up a Notch
Google Analytics uses data from your Website to prepare a neat looking application where you can explore your data and answer what I consider your first-level questions. First-level questions are the most basic things you might want to know, such as How many? What Time Period? It is the second- and third-level questions where the analysis and action plans come into play. After all, it’s not enough to know how many people visited the site – you need to know what segment attracted them and how do you keep them coming back for more. [More articles about Google Analytics here] Reviewing the Google Analytics Dashboard In the Google Analytics site from the Home tab, you can design a dashboard to review what you consider key measurements for your site. This dashboard is easy to use and works great for checking daily traffic. However, these measurements answer your basic questions, such as the counts. It’s more difficult to use the information for in-depth discovery. For instance, in the following figure I am comparing month over month traffic for the site using the Dashboard. This number indicates the total visits for each month. So, what can I learn from these metrics? Traffic […]
SAS Enterprise Guide: Quick Tip for Selecting Text in Columns
Earlier in the week I discussed how I used Google Analytics to help me discover topics of the most interest. SAS Enterprise Guide was a popular topic, so here’s a quick tip that I like to use when working with text in columns. Moving Text around in SAS Enterprise Guide When it comes to data entry, I can assure you that I put the “Z” in lazzzzzzzzzzzzzy. Blech, I hate it more than pie charts. It’s the first thing I’ll have my home robot do when they finally become as normal as a refrigerator. So here’s a tip to save you some keystrokes. When you copy text in SAS EG, you generally have to copy entire rows, but sometimes you just need a list of variable names or the variable values. When you need to copy a column of data, do the following: Hold the ALT key while clicking and dragging to select the column. The column turns blue so you know it works. Press Ctrl+C to copy the column. Click where you want to place the text and press Ctrl+V to paste it. Then you can make any edits you desire. Applying this Trick Other Areas You can […]