|
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Ben
> Sent: Thursday, October 06, 2011 8:58 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Scanning the string
>
> Your methods are great, but what if the case is a little bit complcated
> like following:
>
> the demension of array is going to be varied from 2 to 50.
>
>
> ************************;
> data _null_;
> infile datalines ...;
>
>
> datalines;
> aa*bb**dd*ee****ii
> a*b
> ;;;;
>
> ***********************;
>
>
>
>
>
> On Wed, 5 Oct 2011 17:19:56 -0400, Ben <benpub7@YAHOO.COM> wrote:
>
> >data _null_;
> >STR='aa*bb**dd*ee****ii";
> >
> >put s1= s2= s3= s4= s5= s6= s7= s8= s9= s10=;
> >run;
> >
> >*the desired results;
> >
> >s1='aa' s2='bb' s3='' s4='dd' s5='ee' s6='' s7='' s8='' s9='' s10='ii'
> >
> >**instead of;
> >s1='aa' s2='bb' s3='dd' s4='ee' s5='ii'
> >
> >Thanks
> >
> >ben
Ben,
To provide a practical answer I would need to know more about what you are actually doing. I assumed your data _null_ examples were just a way to look at string scanning. What is your real task? What do you mean "the demension of array is going to be varied from 2 to 50"? Are you actually creating a SAS dataset, or are your "putting" values to a CSV file, or ...?
If you provide more context, you will get answers more tailored to your needs.
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|