In the DATA step, the WHERE statement and the IF statement (a.k.a. the "subsetting IF") have similar functions. In many scenarios, they produce identical results. But new SAS programmers are taught early on that these two statements work very differently, and in important ways. To understand the differences, it helps
Tag: SAS programming
SAS programmers often resort to using the X command to list the contents of file directories and to process the contents of ZIP files. In centralized SAS environments, the X command is unavailable to most programmers. NOXCMD is the default setting for these environments (disallowing shell commands), and SAS admins
First, if you landed on this topic because you encountered this SAS message: ERROR 180-322: Statement is not valid or it is used out of proper order. ...then I'll tell you right now: you've probably left off a semicolon in one of your SAS statements. If you're lucky, the SAS
A colleague approached me with this very important business problem: Every Friday at SAS HQ, SAS cafe staff provides a breakfast goodie in our breakrooms. Often the supplied goodie is delicious, but sometimes it's more...well...healthy. I want to know whether I should eat my breakfast before I leave home on
I've been working on a SAS program that can add content to the SAS Support Communities (more on that in a future post). Despite my 20+ years of SAS experience, there are a lot of SAS programming tricks that I don't know. Or that I use so infrequently that I
One thing that we have a lot of at SAS: installations of SAS software that we can run. I have SAS for Windows on my laptop, and I have access to many centralized instances of SAS that run on Linux and Windows servers. (I also have access to mainframe SAS,
I know what you're thinking: two "Boaty McBoatface" articles within two weeks? And we're past April Fool's Day? But since I posted my original analysis about the "Name our ship" phenomenon that's happening in the UK right now, a new contender has appeared: Poppy-Mai. The cause of Poppy-Mai, a critically
In a voting contest, is it possible for a huge population to get behind a ridiculous candidate with such force that no other contestant can possibly catch up? The answer is: Yes. Just ask the folks at NERC, the environmental research organization in the UK. They are commissioning a new
In previous articles, I've shared tips about how you can work with SAS and ZIP files without requiring an external tool like WinZip, gzip, or 7-Zip. I've covered: How to create ZIP files with ODS PACKAGE ZIP (available since SAS 9.2) How to "unzip" and read ZIP files using FILENAME
TL;DR The next time that you find yourself writing a PROC SORT step, verify that you're working with the SAS Base engine and not a database. If your data is in a database, skip the SORT! The details: When to skip the PROC SORT step Many SAS procedures allow you