Date: Wed, 18 Mar 2009 12:09:25 -0700
Reply-To: jain.vineet.i@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: jain.vineet.i@GMAIL.COM
Organization: http://groups.google.com
Subject: parsing delimited string to variables
Content-Type: text/plain; charset=ISO-8859-1
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 _NULL_ ;
%LET Y = 0;
%Global Looping;
%LET Looping = %EVAL(&DimensionCount+1) ;
DO I = 1 TO &Looping BY 1;
%LET y = %eval(&y +1);
%Let Xt = %SCAN(&tempDimensionName,&Y,*) ;
CALL SYMPUT (RESOLVE('Variable')||left(I), &Xt);
END;
run;
A little help in writing an efficient code for this is greatly
appreciated.
Thanks,
Vineet.
|