Date: Tue, 2 Feb 2010 12:52:19 -0500
Reply-To: Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject: Re: How to force the execution order of COMPUTE blocks in PROC
REPORT?
Thank you Mark,
Unfortunately that gives me the lines 5, 6, 10, 11 and 14, while I want the
lines 1, 2, 3, 5, 6, 7, 8, 10, 11, 12 and 14. So I just don't want the lines
4, 9 and 13. So I actually would like the execution of the compute blocks
reversed. Then I will get what I want.
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
http://jim.groeneveld.eu.tf
On Tue, 2 Feb 2010 09:18:11 -0800, Terjeson, Mark <Mterjeson@RUSSELL.COM> wrote:
>Hi Jim,
>
>You have LINE output for compute block A
>so I presume you want a line output for
>each of the A groups (i.e. 5,10,14).
>So if you also want the lines 6 and 11,
>just change
> IF (A_done_no_B) THEN Line_Len = 0;
>to
> IF not (A_done_no_B) THEN Line_Len = 0;
>
>
>
>Hope this is helpful.
>
>
>Mark Terjeson
>Investment Business Intelligence
>Investment Management & Research
>Russell Investments
>253-439-2367
>
>
>Russell
>Global Leaders in Multi-Manager Investing
>
>
>
>
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jim
>Groeneveld
>Sent: Tuesday, February 02, 2010 9:02 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: How to force the execution order of COMPUTE blocks in PROC
>REPORT?
>
>Subject: How to force the execution order of COMPUTE blocks in PROC
>REPORT?
>
>Hi friends,
>
>Consider and run the following rather simplified SAS program, creating a
>REPORT of a dataset.
>I want different lines in the report after each level of variables A and
>B,
>but not both.
>So I don't want lines 4, 9 and 13, but I want lines 6, and 11 in the
>example.
>
>The program code tries to remember the event of a _last_ unchanged value
>of
>A and
>based on that attempts to inhibit the line for the variable B (using
>A_done_no_B).
>The code seems correct, but the COMPUTE blocks apparently execute in the
>wrong,
>reverse order. How do I force the reverse (or any desired) order for
>COMPUTE
>blocks?
>
>Regards - Jim.
>--
>Jim Groeneveld, Netherlands
>Statistician, SAS consultant
>http://jim.groeneveld.eu.tf
>
>~~~~~~~~~ BEGIN PROGRAM CODE ~~~~~~~~~
>OPTIONS FORMCHAR = '|----|||---' LINESIZE=80 PAGESIZE=66;
>
>DATA TestData;
> INPUT a b c;
> CARDS;
>1 2 3
>1 2 4
>1 3 5
>1 3 6
>1 4 7
>1 4 8
>1 5 9
>1 5 0
>2 3 0
>2 3 1
>2 3 2
>2 3 3
>2 3 4
>2 4 6
>2 5 8
>2 6 0
>2 6 1
>3 4 5
>3 5 7
>3 5 8
>3 6 9
>3 6 0
>;
>RUN;
>
>PROC REPORT DATA=TestData HEADLINE;
> COLUMN ('--' a b c);
> DEFINE a / ORDER;
> DEFINE b / ORDER;
> DEFINE c / DISPLAY;
> COMPUTE AFTER a;
> TextLine = 'Line=##---A=#-----------------------------------';
> SUBSTR(TextLine,13,1) = PUT (A, 1.);
> Increase + 1;
> SUBSTR(TextLine,6,2) = PUT (Increase, 2.);
> Line_Len = LENGTH(TextLine);
> LINE TextLine $VARYING. Line_Len;
> A_done_no_B = 1;
> ENDCOMP;
> COMPUTE AFTER b;
> TextLine = 'Line=##- -B=#- - - - - - - - - - - - - - - - - -';
> SUBSTR(TextLine,13,1) = PUT (B, 1.);
> Increase + 1;
> SUBSTR(TextLine,6,2) = PUT (Increase, 2.);
> Line_Len = LENGTH(TextLine);
> IF (A_done_no_B) THEN Line_Len = 0;
> LINE TextLine $VARYING. Line_Len;
> A_done_no_B = 0;
> ENDCOMP;
>RUN;
>~~~~~~~~~ END PROGRAM CODE ~~~~~~~~~
|