LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2012, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 13 Mar 2012 10:35:29 -0500
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: Programmatically matching parentheses. How?
Comments: To: Jim Groeneveld <jim.1stat@yahoo.com>
In-Reply-To:  <1331652299.66010.YahooMailNeo@web46103.mail.sp1.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1

For the situation you describe I would look to another parametrization. I'm not a fan of enumerated parameters DATA1=,DATA2= but this might be a good place to use them. Plus I don't think the users would find the enumerated parameters difficult to use, perhaps easier.

On Tue, Mar 13, 2012 at 10:24 AM, Jim Groeneveld <jim.1stat@yahoo.com> wrote: > Hi Data_Null, > > The information will be stored in a macro variable. > I need it to specify only one dataset (with its options) at a time to PROC > CONTENTS. > The options may drop or keep or rename variables or delete observations. > And that in its turn is necessary for my cross reference macro CrossRef > (see http://home.hccnet.nl/jim.groeneveld/software/SASmacro/CrossRef.zip). > That macro in its turn is used to compare datasets with regard to > dataset and variable attributes and main univariate statistics. > The comparison in its turn is needed to decide about overlapping datasets > or inconsistently named or coded variables. > That in its turn is needed to clean up a large number of ad hoc datasets. > And that finally is needed to improve the data management (with SAS). > Regards - Jim. > -- > Jim Groeneveld, Netherlands > Statistician/SAS consultant > http://jim.groeneveld.eu.tf > ________________________________ > From: "Data _null_;" <iebupdte@gmail.com> > To: Jim Groeneveld <jim.1stat@yahoo.com> > Cc: SAS-L@listserv.uga.edu > Sent: Tuesday, 13 March 2012, 15:53 > > Subject: Re: Programmatically matching parentheses. How? > > I think you need to explain what you doing in more detail. Are you > sure you need to separate the options from the data set names? What > then? > > You may be focused on the wrong part of the problem. > > On 3/13/12, Jim Groeneveld <jim.1stat@yahoo.com> wrote: >> Hi Ron, >> >> Thanks. If no one comes with a complete solution I'll have to develop it >> myself some of these days. I'll study your (and/or Toby's) suggestions. >> I'm >> not (yet) experienced in using regular expressions, but I would report any >> solution that I find here on SAS-L. >> >> Regards - Jim. >> -- >> Jim Groeneveld, Netherlands >> Statistician/SAS consultant >> http://jim.groeneveld.eu.tf >> >> >> On Tue, 13 Mar 2012 12:18:56 +0000, Fehd, Ronald J. (CDC/OCOO/ITSO) >> <rjf2@CDC.GOV> wrote: >> >>>> From: Jim Groeneveld >>>> Sent: Tuesday, March 13, 2012 5:16 AM >>>> To: SAS-L@LISTSERV.UGA.EDU >>>> Subject: Programmatically matching parentheses. How? >>>> >>>> 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 >>> >>>Hi Jim >>>My suggestions are that you will have to parse your list with %substr >>> >>>list = data1 data2(dsoptions2) data3 data4(dsoptions4) >>> >>>repeat: >>>pick the I-th data set name with >>>%Let dsn = %scan(&List,&I,%str( )%str(()); >>> >>>remove the dsn from the list with either tranwrd or >>>%Let list = %substr(&List,%length(&dsn)); >>> >>>check for existence of open paren: >>>%if %substr(&List,1,1_ eq %str(() %then %do; >>>*pick or remove; >>>%Let dsoptions = %scan(&List,1,%index(&List,%str()); >>> >>>%Let list = %sysfunc(tranwrd(&List,&dsoptions., )); >>> >>>return.to repeat >>> >>>hth >>> >>>Ron Fehd list processing maven >>> >>>of course %str(() or %str()) may not work exactlyas predicted. >>>otherwise run it thru a data _Null_ step >> > >


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