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 (March 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Mar 2009 01:11:52 +0530
Reply-To:     Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Subject:      Re: parsing delimited string to variables
Comments: To: jain.vineet.i@gmail.com
In-Reply-To:  <38d4f6cc-427e-48e1-8d80-4b006016d166@41g2000yqf.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Mar 19, 2009 at 12:39 AM, <jain.vineet.i@gmail.com> wrote: > I am trying to parse a delimited string into variables. I do not know > how many values are there in the string. > e.g. tempDimensionName= Measure1* Measure2* Measure3* Measure4* > Measure5...Measure<n> > DimensionCount = Occurances of '*' in the above string > I want to get: Variable1=Measure1 Variable2=Measure2 ... > Variable<n>=Measure<n> > This is what I wrote which is of course wrong. >

data test; tempDimensionName = "M1*M2*M3*M4"; run;

data _null_; set test; call symput('numDim', left(put(countc(tempDimensionName, '*'),8.))); run; %macro createDims(); data test2; set test; %do i = 1 %to &numDim; Variable&i = scan(tempDimensionName, &i, '*'); %end; run; %mend createDims; %createDims()

Regards, Anindya


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