In my new book, End-to-End Data Science with SAS: A Hands-On Programming Guide, I use the 1.5 IQR rule to adjust multiple variables. This program utilizes a macro that loops through a list of variables to make the necessary adjustments and creates an output data set. One of the most
One of the first and most important steps in analyzing data, whether for descriptive or inferential statistical tasks, is to check for possible errors in your data. In my book, Cody's Data Cleaning Techniques Using SAS, Third Edition, I describe a macro called %Auto_Outliers. This macro allows you to search
Whether you are a strong believer in the power of dividing by zero, agnostic, undecided, a supporter, denier or anything in between and beyond, this blog post will bring all to a common denominator. History of injustice For how many years have you been told that you cannot divide by
The %SYSFUNC macro function allows you to access most SAS® functions. In this blog post, I demonstrate how %SYSFUNC can help in your programming needs when a macro function might not exist. I'll also share the formatting feature that is built in to %SYSFUNC and introduce the %QSYSFUNC that masks the returned value.
Would you like to format your macro variables? Easy! Just use the %FORMAT function, like this: What?! You never heard of the %FORMAT function? Of course not, cuz it doesn't exist! No problem. Just create it, like this: %macro format(value,format); %if %datatyp(&value)=CHAR %then %sysfunc(putc(&value,&format)); %else %left(%qsysfunc(putn(&value,&format))); %mend format; The %FORMAT
The stored compiled macro facility enables you to compile and save your macro definition in a permanent catalog in a library that you specify. The macro is compiled only once. When you call the macro in the current and subsequent SAS® sessions, SAS executes the compiled code from the macro
How many of you have been given a SAS data set with variables such as Age, Height, and Weight and some or all of them were stored as character values instead of numeric? Probably EVERYONE! Yes, we all know how to do the old "swap and drop" (rename and convert), but
Have you ever needed to run code based on the client application that you are using? Or have you needed to know the version of SAS® software that you are running and the operating system that you are running it on? This blog post describes a few automatic macro variables
The English language, a mishmash of words from many tongues and with rules that aren’t always consistent, sometimes causes people to stumble when writing quotes. There are numerous humorous websites with examples of incorrectly-used quotes on signs saying things like “Sandwiches Prepared ‘Fresh’,” or “Help ‘Wanted’ – Please ‘inquire’ within”.
Have you ever created a SAS macro variable and at resolution time received a warning that it did not exist? Many times this warning is because your program referenced the macro variable outside the scope it was created in. Every macro variable created is stored in one of two symbol
Have you ever received an error or warning in SAS macro and did not know what to do next or even where to look? Now there is an answer! And debugging your SAS macros just got easier. All macro errors and warnings are now documented in the SAS 9.4 Macro
Are there times when you need to pass special characters to a macro variable but cannot find the right technique to accomplish the task? In this article I’ll discuss the different macro quoting functions and give a simple technique to help you determine which macro quoting function to use. Why
This week's SAS tip is from Robert Virgile and his illuminating new book SAS Macro Language Magic: Discovering Advanced Techniques. Robert has 30 years of experience developing and teaching SAS classes. And his new book is filled with powerful programming techniques. If you like this week's free excerpt, you can read
Some very common questions we receive into Technical Support are, “I need to be able to send the data for every hospital listed in my data set to a separate .csv file. How can I do that?” Or, “How can I run a PROC REPORT for each region listed in
If you routinely import data from external sources, chances are you’ve learned the value in having a systematic import process. In this post, I will begin sharing my approach of using metadata tables to guide the importing of data.
This week's SAS tip is from Art Carpenter and his latest book Carpenter's Guide to Innovative SAS Techniques. Art is a talented SAS user and prolific author--and was just recognized in the SAS Circle of Excellence for 30 years of using SAS software. After taking a look at this week's book
Continuing with our stringed list theme, in this post I would like to talk about applying functions to those lists. So far we have developed quite a few tools that can manipulate lists in different ways, but what good are they if we can’t do something meaningful with the lists?
In my previous post, I began a discussion of lists by explaining that big problems can be solved by breaking the problem into smaller pieces. The solutions to those smaller problems can then be used in combination to solve other problems. In this post, I will talk about formatting and
There are many different ways to do something; my approach is all about breaking a problem into smaller problems. I try as much as possible to stay away from developing something that can only serve a purpose in one problem. I achieve this by keeping things modular. Each tool should
This week's %NLINMIX macro tips come from the esteemed authors of SAS for Mixed Models, Second Edition. Ramon C. Littell, George A. Milliken, Walter W. Stroup, Russell D. Wolfinger, and Oliver Schabenberger combined their expertise to write this indispensable guide. This 800 page book has made a big impact in the user community
A basic tenet in any profession - whether you're a statistical programmer, developer or blogger - is save your work. For statisticians, saving is important, but archiving is KING! You never know when your client may want you to roll back to a previous version or when someone else may
Today, everyone from chief marketing officers to the senior vice president of sales to bloggers want to know more about the behavior of the readers and consumers who are clicking on Web pages, Internet articles and blogs. Clickstream data is a valuable source of information about the products, services and information that resonates with
As SAS user Marje Fecht said "We all want a 'SAS programming assistant' to help us complete our jobs more quickly." Fecht, Senior Partner at Prowerk Consulting, then went on to say "In her book SAS Macro Programming Made Easy, Second Edition, Michele Burlew encourages us to take advantage of the SAS
If you’ve taken one of my SAS classes you may recall “Mark’s 3 rules of programming”, the first of which is “Lazy programmers are GOOD programmers.” One of the things I love about best about SAS programming is the plethora of functions and shortcuts built into the language, all designed
In a production environment, where dozens of SAS programs are run in sequence, often monthly or quarterly, and where logs can span thousands of lines, it’s easy to overlook the small stuff that can cause data hangovers. Recognize any of these? A temporary data set finds its way into subsequent
If you've been to a SAS Forum, US SAS Regional or local SAS event, you know that it is impossible to see and hear everything that is on your list. Imagine how disappointed your SAS colleagues are who are sitting at home. They would love to hear about what you
Like many SAS users, Bill Roehl uses SAS in some very clever ways that aren’t necessarily work-related. Roehl is a Research Analyst at Capella University and an outspoken community journalist. When he isn’t working for Capella University, he is hard at work blogging about community news for Dakota County, Minnesota
Contributed by Bill Roehl, Data Geek at Capella University (@garciasn) Analysts love raw data and end-users love to see that same data displayed in beautiful charts and pictures with exciting color. Dr. Danni Bayn, a Research Analyst at Capella University in Minneapolis, provides a drop-in method for SAS users to