Date: Wed, 4 Oct 2006 09:23:40 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: long macro variable in SASHELP.VMACRO?
In-Reply-To: <4oh2qtFek96vU1@individual.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Thank you Richard. This is a exactly what I was asking about and a
very nice bit of code. I guess I should not have mentioned the M
word.
Got any ideas on how to handle "ill conditioned" delimiters. I would
ultimately like to scan blank delimited data that could have multiple
blank delimiters.
On 10/4/06, Richard A. DeVenezia <rdevenezia@wildblue.net> wrote:
> "data _null_;" wrote:
>
> > I still want to figure out how to do it using the data in
> > SASHELP.VMACRO.
>
> Some standard processing for wrapped delimited input. Trailing space
> boundary issues should be handled properly.
> -------------------------------------------------------
> options nocenter linesize=250;
>
> data ugh;
> do row = 1 to 64000/13;
> output;
> end;
> run;
>
> proc sql noprint;
> select put(row,z10.) into: ick separated by ' | ' from ugh;
> quit;
>
> %put %length(&ick.) ;
>
> data bleah;
> set sashelp.vmacro end=end ;
> where name='ICK';
>
> put value $CHAR240.;
>
> length line $400 token $80;
> retain line trailings;
>
> if (_n_ = 1) or (trailings=0 and line='') then
> line = value;
> else
> if (trailings = 0) then
> line = trim(line) || value;
> else
> line = catx(repeat(' ',trailings-1),line,value);
>
> put line $CHAR240.;
>
> trailings = 200 - length(value);
>
> do i = 1 to count(line,'|');
> token = scan(line,i,'|');
> output;
> end;
>
> if end and substr(line,length(line)) ne '|' then flag=1;
>
> line = scan(line,-1,'|');
>
> if flag then do;
> token=line;
> output;
> end;
>
> keep token;
> run;
> -------------------------------------------------------
>
> Richard A. DeVenezia
> http://www.devenezia.com/
>
|