How to write a SAS macro program to repeat your SAS processing for each value of a BY grouping variable.
English
The SAS/IML language supports both row vectors and column vectors. This is useful for performing linear algebra, but it can cause headaches when you are writing a SAS/IML module. I want my modules to be able to handle both row vectors and column vectors. I don't want the user to
If you have been reading the Unofficial Official Guide to SAS Global Forum series, you have already gotten some great tips on where to stay, what to do and what to wear (more coming soon!). My best tip this week, is a great money saver, and it is simple. “Hurry
When the data is classified by multiple class variables, you can certainly create graphs using BY variables. This results in separate graphs, one for each level of the BY variable crossings. Each graph is scaled by its own data subset, and comparisons across BY levels is harder. When comparisons need to be
You can keep track of and report anything with SAS, even motivation - or the lack thereof. This team has developed a portal to analyze and report their ride data. It could just as easily be used for groups who want to work together to lose a few pounds, train
When you are constantly taking the data tables and completing joins to begin working on your reports or analysis it might be time to consider creating permanent views. Then you can just add the view to the Enterprise Guide project rather than dealing with the joins in a Query Builder
A recent discussion on the SAS-L discussion forum concerned how to implement linear interpolation in SAS. Some people suggested using PROC EXPAND in SAS/ETS software, whereas others proposed a DATA step solution. For me, the SAS/IML language provides a natural programming environment to implement an interpolation scheme. It also provides
St. Patrick’s Day is almost here and for many it’s the perfect time to think green. This holiday, for me as a US citizen, means a little less than a month before taxes are due. I am often thinking green, as in money and saving some! For SAS users from around
A well-formed WHERE statement or subsetting IF can narrow down the output of your SAS DATA step. The SAS log does a good job of telling you how many records were processed by the action. For example, let's look at this simple DATA step with my "poor man's random sample",
A few weeks ago, in Northern Virginia, a 30 foot highway sign fell onto I-66 and landed on a passing pickup truck. Fortunately, no one was hurt, but it drew media attention and caused motorists in the area to wonder about the safety of other signs and the transportation network
After unwittingly getting involved recently in a code vs GUI discussion another pro GUI vote came in yesterday when presenting to a customer's internal user group. When creating and using prompts in SAS Enterprise Guide, it is a no-brainer to recommend leveraging the %_eg_WhereParam as it handles all the special
Most statistical programmers have seen a graph of a normal distribution that approximates a binomial distribution. The figure is often accompanied by a statement that gives guidelines for when the approximation is valid. For example, if the binomial distribution describes an experiment with n trials and the probability of success
Most users of the ODS Graphics system have probably had the need to adjust the dimensions of their graph output at times. The ODS GRAPHICS statement makes this easy to do. This statement supports the WIDTH= and HEIGHT= options. If you set just one of these, the system will calculate
Did you oversleep this morning? If you live in the United States of America, Monday morning seems to have arrived just a bit earlier, accompanied by a bit more "dark" than usual. That's because as good time-fearing citizens, we have all set our clocks ahead by one hour so as
SAS provides several ways to compute sample quantiles of data. The UNIVARIATE procedure can compute quantiles (also called percentiles), but you can also compute them in the SAS/IML language. Prior to SAS/IML 9.22 (released in 2010) statistical programmers could call a SAS/IML module that computes sample quantiles. With the release
Sometimes, I pick something fun to do with SAS/GRAPH so that I can learn and experiment with some of the more obscure functionality that I'm wanting to master. This is one of those situations. This fun graph allowed me to experiment with crosshatch patterns in maps, overlapping map areas and creating 'holes' in maps.
If your company has an EPTO account, it could be like getting a FASTPASS ticket to SAS Global Forum. EPTO units won't move you to the head of the line like FASTPASS (there are no lines), but they can pay for your SAS Global Forum event registration fees! Don’t know what
The Adverse Event Timeline graph posted earlier used the MARKERCHAR option of the SCATTER plot to draw the AE names. This option places a center-justified label at the marker position. There is no option in SAS 9.2 version to right-justify the label. Hence, we have to compute an offset in data
In the United States, this upcoming weekend is when we turn our clocks forward one hour as we adopt daylight saving time. (Some people will also flip their mattresses this weekend!) Daylight saving time (DST) in the US begins on the second Sunday in March and ends on the first
A few years ago I had the privilege of presenting the last technical paper at SAS Global Forum. This year, conference chair Andy Kuligowski asked me to go one better than that, and present a talk at the official Closing Session. What will I talk about? That's a mystery (maybe
During IFSUG yesterday, Sunil Gupta gave attendees to his presentation a special homework assignment. Look into the SAS Enterprise Guide task 'Characterize Data'. Sunil suggested that this was a simple approach to quickly getting a summary of all the variables within your data table. Of course, some programmers will use
I work with continuous distributions more often than with discrete distributions. Consequently, I am used to thinking of the quantile function as being an inverse cumulative distribution function (CDF). (These functions are described in my article, "Four essential functions for statistical programmers.") For discrete distributions, they are not. To quote
"Bad data does exist," says Sunil Gupta, SAS author and Global Corporate Trainer, Gupta Programming. Gupta is an expert in the pharmaceutical and medical device industry, but he volunteered this week to speak to an audience of SAS users in the insurance and financial services industries about minimizing the impact and
Today at IFSUG, Chuck Patridge presented a wonderful talk about how to complete fuzzy matching using BASE SAS tools. Chuck has been programming SAS since 1979 and has been tasked multiple times with coming up with in-house solutions to address business needs without the software costs that are typically associated
The next time you write a DATA step, try to express it in iambic pentameter. Or instead of a SAS macro function, how about a SAS macro sonnet? (Or, for the more base among you, a limerick?) That's the spirit behind the code {poems} project. You write a poem in
Bubble plots are often used to display social and economic data as Gapminder effectively does. With the addition of the BUBBLEPLOT statement to SAS 9.3, it is now possible to create bubble plots in SAS with a few lines of code: proc template; define statgraph bplot; begingraph; entrytitle 'Bubble Plot
By show of hands, I’d like to know what you consider to be the most exciting day of SAS Global Forum
As a SAS developer, I am always looking ahead to the next release of SAS. However, many SAS customer sites migrate to new releases slowly and are just now adopting versions of SAS that were released in 2010 or 2011. Consequently, I want to write a few articles that discuss
If you've never lived outside of your own small town, you might not realize that each country has a distinct way of writing and formatting currency and numbers. This can be a real problem when working with data and code - I'll bet some of you are already aware of
I've blogged several times about multivariate normality, including how to generate random values from a multivariate normal distribution. But given a set of multivariate data, how can you determine if it is likely to have come from a multivariate normal distribution? The answer, of course, is to run a goodness-of-fit