Here's a Proc Print trick for grouped data. Suppose your data is divided into groups, such as males and females. You could sort by the grouping variable before printing, like this: Suppose you want to better emphasize the groups. You could add a BY statement, like this: OK, but, personally,
Tag: tips and tricks
A ghoulish Halloween Boo to all my readers! Hope my costume freaks you out, but even if it doesn't, I’m positive PROC FREQ will in a few amazing ways! Today’s Programming 2: Data Manipulation Techniques class asked about the power of PROC FREQ. Since I stopped to explain some of it's benefits to
Suppose you want a list of car manufacturers from the CARS dataset. Easy! Call the %CHARLIST macro from a %PUT statement, like this: The CHARLIST macro generates a list of unique values of a selected variable from a selected dataset. So does PROC FREQ. But, if you don't need statistics, the CHARLIST
The previous post on Multiple Blank Categories showed how to include multiple blank categories on the axis. But, given the purpose for this was to separate different segments in the data, I also included ideas on how to segmented a discrete axis using reference lines or Block Plot. A similar idea
Off and on, users have expressed the need to include multiple blank categories on a discrete axis. Often, this is desirable to separate groups of bars (or categories) in a graph due to some difference their definition. Such a case was discussed in this blog article on using non breaking
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
In this post I describe the important tasks of data preparation, exploration and binning.These three steps enable you to know your data well and build accurate predictive models. First you need to clean your data. Cleaning includes eliminating variables which have uneven spread across the target variable. I give an
Datasets are rarely ready for analysis, and one of the most prevalent problems is missing data. This post is the first in a short series focusing on how to think about missingness, how JMP13 can help us determine the scope of missing data in a given table, and how to
Elizabeth is courageous. Scoliosis since birth, corrective spinal surgery replaced her spine with steel, tripping on stairs permanently broke her right ankle. Then she decided to come take yoga with me. To help ease back pain & reduce hip stress, I offered options like bent legs not cross. In class
When developing SAS® data sets, program code and/or applications, efficiency is not always given the attention it deserves, particularly in the early phases of development. Since data sizes and system performance can affect a program and/or an application’s behavior, SAS users may want to access information about a data set’s
Ok, so you know how to create multiple sheets in Excel, but can anyone tell me how to control the name of the sheets when they are all created at once? In the ODS destination for Excel, the suboption SHEET_INTERVAL is set to TABLE by default. So what does that
SAS® users have an easy and convenient way to quickly obtain useful information (referred to as metadata) about their SAS session with a number of read-only SAS DICTIONARY tables or SASHELP views. At any time during a SAS session, information about currently defined system options, libnames, tables, columns and their
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
This SAS Jedi is very excited about the SAS 9.4 M4 release, which brought many wonderful gifts just in time for Christmas. So in the interest of extending the Christmas spirit, I'm going to blog about some of my favorites! I've long loved the SAS DO statement variant which allows
My river walk last week turned into a spectacular fall show. But if it rains this week in San Antonio, like the weatherman predicts, what will I do? In the coming days, I’ll be presenting at two user groups, one in eastern Canada in Halifax, and the other all the
SAS Programming Professionals, SAS & bugs & rock & roll? But, of course! SAS Because of its amazing versatility, SAS is indisputably the greatest software package currently in use anywhere within the Milky Way Galaxy. Can SAS input every type of flat file imaginable? Yes! Can SAS read and write
Last time I checked, there are well over 500 functions and call routines in SAS. I’ve taught SAS programming courses for 15 years, and I’ll admit that occasionally my students will ask me about a particular function that I have honestly never heard of. I remember the first time this
A reader posed a question in the comments to an earlier Jedi SAS Trick, asking how to write the results of a DS2 DATA _NULL_ program to a text file. It's an interesting question, as DS2 currently has no text file handling statements or capabilities. Take, for example, this traditional
In my previous post, Jedi SAS Tricks - Make This a Button in Base SAS I demonstrated running a SAS program from a tool bar button in the SAS Windowing environment. The program we execute is the macro from a previous post, Jedi SAS Tricks: The DATA to DATA Step
As the excitement of SAS Global Forum begins to die down and we dust off our sequins for another year, it’s time to get back behind the desk. This year at SAS Global Forum we hosted a "Top Tips from Your Favorite SAS Press Authors" lunch where we asked three or four
A recent post, Jedi SAS Tricks: The DATA to DATA Step Macro, engendered a lot of response on Twitter. One of the re-tweets included a call to action - make this a button in Base SAS!
When you’re making a report, how do you choose which procedure to use? The answer is – it depends. It depends on: whether you are doing an ad hoc analysis or creating a final report that many people will see whether you will run statistical tests with your data or
I was answering questions about SAS in a forum the other day, and it struck me how much easier it is to help folks if they can provide a snippet of data to go along with their program when asking others to help troubleshoot. This makes it easy to run
In “Explaining statistical methods to the terrified & disinterested: A focus on metaphors”, I discuss the usefulness of metaphors for explaining abstract statistical concepts to non-technical readers. This is an approach taken in my new SAS Press book, Business Statistics Made Easy in SAS®, since many readers of this level
Do any of your New Year’s resolutions include the goal to become a more productive SAS user? Whether you’re building models or reports using SAS or you’re using SAS to effectively manage your data, you likely have a goal to be as productive as possible with your SAS usage in
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”.
Last Christmas I decided to knit a scarf while at a concert in the Bahamas. A little boy and his sister sitting in front of me watched me very intently. Their eyes grew bigger and bigger as the scarf grew longer and longer. Finally the little boy couldn’t take it
One of the frustrating outcomes of the data import process is when a variable that you need to be numeric is imported as character. This often happens because the column of data contains non-numeric data, for example, where blanks in a database are exported as “NULL” instead of a true
Many readers in applied areas (business, health, psychology & sociology, education, and several others) are reading statistics texts under duress for a course or project, and are in truth somewhere between disinterested and terrified. In my new SAS Press book Business Statistics Made Easy in SAS® I knew that I
As I visit my clients, it sometimes surprises me when they avoid the use of PROC REPORT. “It’s too different”. Even those that do use it, often fail to take advantage of the procedure’s power by ignoring the compute block. Yes this procedure is different from any other. Yes using