文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 自然科学 > 数学 > Regular Expressions in SAS
侵权投诉

Regular Expressions in SAS

SAS EG

SASGlobalForum2012SAS® Enterprise Guide® Implementation and Usage

Paper 299-2012 Regular Expressions in SAS® Enterprise Guide®

Mark Tabladillo PhD, MarkTab Consulting, Atlanta, GA

Associate Faculty, University of Phoenix

ABSTRACT

In version 9, the SAS® System introduces Perl regular expressions (sometimes known by the acronym PRX, the first

three letters of these functions or call routines). However, previous versions of SAS® already had regular expressions

(known by their acronym RX, the first two letters of these functions or call routines). This presentation will describe

specific functional and performance differences in these two exclusive regular expression strategies, and offer

recommendations on when to use each strategy. The technologies will be compared using SAS Enterprise Guide®

4.3.

INTRODUCTION

Regular expressions are the foundation of character pattern matching. Increasingly, textual data is becoming

important in both descriptive and predictive analytics as processing power increases and disk cost decreases. SAS®

software historically offered robust RX regular expressions (Cassell, 2004), though now deprecated in SAS® 9.3.

Fortunately, SAS Institute had already introduced Perl regular expressions (PRX). The best practice for already-

existing RX regular expressions is to migrate them to Perl regular expressions in SAS® 9.3 and Enterprise Guide®

4.3.

While SAS Institute offers other excellent advanced products for text mining, Perl regular expressions provide

complex text analysis within the Enterprise Guide® license. Intermediate to advanced Enterprise Guide® users

should become aware of what this software can provide for character analytics. This regular expression technology

can accept any characters you could put into quotations within a SAS data step (the specifics are determined by the

configuration of your SAS® installation and native operating system), thus expanding possible use beyond just

English.

Let’s define some terms pertinent to this topic (SAS Institute, 2012c, 2012e):

Pattern matching enables you to search for and extract multiple matching patterns from a character string in one step, as well as to make several substitutions in a string in one step. Regular expressions are a pattern language which provides fast tools for parsing large amounts of text. Metacharacters are special combinations of alphanumeric and/or symbolic characters which have specific meaning in defining a regular expression. Character classes are single or combinations of alphanumeric and/or symbolic characters which represent

themselves.

Though the SAS Institute documentation says pattern matching can be done in one step, useful examples of regular

expressions often involve several steps. A few code lines with Perl regular expressions replace potentially many

lines of code. Single-step pattern matching allows for easier use in PROC SQL and the %SYSFUNC macro

command. However, multiple step pattern matching is always available in SAS Enterprise Guide® through the

improved Program Editor (SAS Institute, 2012h).

Regular expressions do not add any functionality beyond what an advanced programmer could write using other SAS

functions combined together, however they do provide essentially a short-cut syntax to accomplish several things in a

shorter amount of space. Functionally, what regular expressions do sounds like it could be a SAS® procedure.

However, the functionality is not implemented with a PROC statement, but instead a combination of CALL routines

and functions which can be used by the DATA step or SAS/Macro language.

Metacharacters are special character combinations used to generate patterns (SAS Institute, 2012e). One well-

known pattern which works in both the SAS and Perl regular expression environments is the asterisk. The asterisk is

a general wildcard character, meaning any zero or more characters. You may have used this metacharacter in the

UNIX or Windows® environment, and it even works with popular search engines like Bing®. However, the repetitive

and high-volume or complex string searching activity common to SAS® applications benefits most from regular

expressions.

What can make regular expressions hard to understand is that they are a combination of:

Alphanumeric and/or symbolic characters representing themselves (character classes)

第1页

你可能喜欢

热门文档

相关文档

  • Regular Expressions

    Andrzej (AJ) Bieszczad Email: andrzej@csun.edu Phone: 818-677-4954 6 Introduction to Regular Expressions Regular Expressions: Negated Character Classes ? ...

  • Regular Expressions

    www.marlabs.com dotnetsatya@gmail.com The usage of Regular Expressions in JavaScript To use regular expression for validation in JavaScript, we use match(...

  • What’s New in SAS 9

    31 New in the DATA step New Functions Perl Regular Expressions DATA step Hash Tables Copyright 2004, SAS Institute Inc. All rights reserved. 32 String ...

  • Regular Expressions

    Regular Expressions Ashley J.S Mills <ashley@ashleymills.com> Copyright ? 2005 The University Of Birmingham Sayid.Young Translates 1 介绍模式匹配是计算机...

  • SAS函数介绍

    regular expression_r(RX) functions and CALL routines CALL RXSUBSTR Finds the...in a character string TRIM Removes trailing blanks from character expressions ...

  • SAS初级认证考试70题

    SAS初级认证考试70题_IT认证_资格考试/认证_教育专区。1.The following SAS program...C. The _ERROR_ variable can be used in expressions in the DATA step....

  • MasteringRegularExpressions04-表达式的匹配原理

    MasteringRegularExpressions04-表达式的匹配原理_机械/仪表_工程科技_专业资料。控制系统表达匹配第 表达式的匹配原理 The Mechanics of Expression Processing 4 章 前...

  • RegularExpressions(2) RegularExpressions 支持的正则...

    Regular Expression 78页 免费 正则表达式例子大全 25页 免费 官方的正则表达式组件 R... 暂无评价 2页 免费 官方的正则表达式组件 R... 暂无评价 1页 免费 官...

  • 11.form validation w regular expressions

    11.form validation w regular expressions_理学_高等教育_教育专区。11.form validation w regular expressions;Web Programming Step by Step Lecture 11 Form Valida...

  • Java Regular Expressions Syntax

    Java Regular Expressions Syntax 阅读次数: 144 次 发布时间: 2010-08-17 13:43:42 发布人: 网络转载 来源: 网络转载 一、正则表达式语法 1.1.字符 x \\...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email