LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2011, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Nov 2011 21:57:04 -0500
Reply-To:     Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject:      Re: Regex: Greedy-repetitive patterns
Content-Type: text/plain; charset=ISO-8859-1

I am not sure if the SCAN function has the equivalent of the DLMSTR option of the INFILE statement. If it does I couldn't find it.

data want ; infile cards dlmstr='\n' dsd truncover; length text $200; do until (text=' '); input text : $200. @; if text ne ' ' then output; end; cards4; 0, Incomplete \n 1, Unverified \n 2, Complete ;;;;

On Wed, 30 Nov 2011 23:05:38 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:

>In actuality Kevin use the scan function either way. > > > > > >Do I = 1 To CountC( Text , '\' ) + 1 ; > > X = Scan( Text , I , '\' ) ; > > X = IfC( X =: 'n' , Substr( X , 2 ) , X ) ; > > Output ; > >End ; > > > > > >If its a new line character then : > > > >Do I = 1 To CountC( Text , '0A'x ) + 1 ; > > X = Scan( Text , I , '0A'x ) ; > > Output ; > >End ; >Toby Dunn > > >If you get thrown from a horse, you have to get up and get back on, unless you landed on a cactus; then you have to roll around and scream in pain. > > �Any idiot can face a crisis�it�s day to day living that wears you out� >~ Anton Chekhov > > > > >> Date: Wed, 30 Nov 2011 16:42:04 -0500 >> From: kviel@SJHA.ORG >> Subject: Regex: Greedy-repetitive patterns >> To: SAS-L@LISTSERV.UGA.EDU >> >> I am making precious little headway on this problem. >> >> From the value: >> >> 0, Incomplete \n 1, Unverified \n 2, Complete >> >> I want >> >> 0, Incomplete >> 1, Unverified >> 2, Complete >> >> I was planning to use a Do-loop with CALL PRXPOSN() using two regexes. I realize that (.+) will be greedy, but my attempts to contain it failed. I figured the negative lookahead (?!\\n) might help. I also realize I have a problem at the end of the string, namely the absence of "\n". >> >> I would appreciate any hints. I started with: >> >> If _n_ = 1 Then __RC = PRXParse( "/(\d+), (.+)(?:\\n)/" ) ; >> If _n_ = 1 Then __RC = PRXParse( "/(?:\\n )?(\d+), (.+)/" ) ; >> >> >> Thanks in advance, >> >> Kevin >> >> >> Kevin Viel, PhD >> Senior Research Statistician >> Patient Safety & Quality >> International College of Robotic Surgery >> Saint Joseph's Translational Research Institute >> >> Saint Joseph's Hospital >> 5671 Peachtree Dunwoody Road, NE, Suite 330 >> Atlanta, GA 30342 >> >> (678) 843-6076: Direct Phone >> (678) 843-6153: Facsimile >> (404) 558-1364: Mobile >> kviel@sjha.org >> Confidentiality Notice: >> This e-mail, including any attachments is the >> property of Catholic Health East and is intended >> for the sole use of the intended recipient(s). >> It may contain information that is privileged and >> confidential. Any unauthorized review, use, >> disclosure, or distribution is prohibited. If you are >> not the intended recipient, please delete this message, and >> reply to the sender regarding the error in a separate email.


Back to: Top of message | Previous page | Main SAS-L page