Tag: regular expressions

Convert a text-based measurement to a number in SAS

Regular expressions are a powerful method for finding specific patterns in text. The syntax of regular expressions is intimidating, but once you’ve solved a few pattern-recognition problems with regex, you’ll never go back to your old methods.

The post Convert a text-based measurement to a number in SAS appeared first on The SAS Dummy.

Ten SAS Enterprise Guide program editor tricks

If you spend a lot of time in SAS Enterprise Guide (as I do), you probably get to know its features pretty well. But we don’t always take the time to explore as we should, so there might be a few golden nuggets of editor knowledge that have escaped you […]

The post Ten SAS Enterprise Guide program editor tricks appeared first on The SAS Dummy.

Boaty McBoatface is on the run

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 […]

The post Boaty McBoatface is on the run appeared first on The SAS Dummy.

And it’s Boaty McBoatface by an order of magnitude

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 […]

The post And it’s Boaty McBoatface by an order of magnitude appeared first on The SAS Dummy.

Using a regular expression to validate a SAS variable name

Regular expressions provide a powerful method to find patterns in a string of text. However, the syntax for regular expressions is somewhat cryptic and difficult to devise. This is why, by my reckoning, approximately 97% of the regular expressions used in code today were copied and pasted from somewhere else. […]

Example 8.27: using regular expressions to read data with variable number of words in a field

A more or less anonymous reader commented on our last post, where we were reading data from a file with a varying number of fields. The format of the file was:1 Las Vegas, NV — 53.3 — — 12 Sacramento, CA — 42.3 — — 2The complication in the…

Some Fun with SAS and Perl Regular Expressions

This post assumes you have a little understanding of how regular expressions work and specifically how SAS implements regular expressions. I recently did something like this and thought it would be good to share. Suppose you have a program that search…