Date: Tue, 13 Mar 2012 12:42:42 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Programmatically matching parentheses. How?
Content-Type: text/plain; charset="Windows-1252"
This would take a little doing to craft but it is what RegEx's are good at doing.
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: Tue, 13 Mar 2012 05:15:33 -0400
> From: jim.1stat@YAHOO.COM
> Subject: Programmatically matching parentheses. How?
> To: SAS-L@LISTSERV.UGA.EDU
> Hi friends,
> I need your help with code that matches parentheses in a (macro) variable
> value. (I will use such code in one or more macros.)
> Problem: a text string containing dataset names and optionally dataset
> options after each dataset name. I need to separate the options from the
> name and so on for each name.
> Just counting opening and closing parentheses isn't sufficient as they can
> be part of literal values (and names) as well. I can find the opening paren,
> but I want to know the position of the closing one.
> I tried to find solutions on the internet with Google, within SAS-L and in
> SAScommunity, but could not find any. Maybe I used the wrong search terms.
> So here goes my quest. Your suggestions are very much appreciated.
> Regards - Jim.
> Jim Groeneveld, Netherlands
> Statistician/SAS consultant