Date: Fri, 6 Oct 2000 07:39:02 -0700
Reply-To: "Stanley A. Gorodenski" <vvgsgor@DE.STATE.AZ.US>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Stanley A. Gorodenski" <vvgsgor@DE.STATE.AZ.US>
Subject: Re: COMPRESS (array, '*') ?
Content-Type: multipart/alternative;
My final solution after fully understanding the problem is the following. It is still done in one
DATA step. This is simple basic programming and requires more statements than the PEEKC/POKE
method (of which I am not familiar with). Aside from possibly requiring less compilation time
(which I believe would be an insignificant consideration anyway), and being cleaner syntax wise
(not as many statements), what else makes the PEEKC/POKE method superior to the the simple basic
method below? I am still learning how SAS operates internally, and perhaps the only solution is
to compare the two methods on cpu and space utilization.
DATA TEMP (DROP=A1 K);
SET TESTFIL;
LENGTH A1 $17.;
ARRAY X V1--V17;
DO OVER X;
IF X NE '*' THEN A1=LEFT(TRIM(A1)||X);
END;
K=0;
DO OVER X;
K=K+1;
X=SUBSTR(A1,K);
END;
PROC PRINT; VAR V1 - V17;
RUN;
Where the SAS file TESTFIL was created by the following program:
DATA TESTFIL;
INPUT (V1-V17) (17*$1.);
CARDS;
AA*B*C*D*E*F*G*H*
J*K*L*M*N*O*P*Q*R
;
Stan
[text/html]
|