Date: Thu, 17 Apr 2008 10:30:11 -0400
Reply-To: "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Subject: Re: Simple proc report question
In-Reply-To: A<7367b4e20804161738ob51a419hfd23e3a200c15165@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
This seems to do it:
proc report nowd headline;
column id s1 s2 x y z;
define id / order;
define x / display;
define y / display;
define z / display;
define s1 / noprint order;
define s2 / noprint order;
break after id / skip;
compute after s2;
line @1 's1=' s1 best. @20 's2=' s2 best.;
endcomp;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
data _null_,
Sent: Wednesday, April 16, 2008 8:39 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Simple proc report question
I'm not good at explaining why they don't show up. I reckon because I
don't completely understand. And I don't use the technique often enough
to remember how to get it to work so if have to fiddle with it.
But the values of S1 and S2 have to be "saved" for later use. This
works but I think other methods will also work. There is a good SGF
paper about the PROC REPORT temporary variable. I will see if I can
find it.
This code seems to achieve the desired result.
data xx;
input id x y z s1 s2;
cards;
1 23 45 32 2.1 0.5
1 45 67 43 2.1 0.5
2 33 75 62 5.1 0.6
2 25 37 33 5.1 0.6
;
options nocenter;
proc report nowd headline /*showall nocenter*/ list;
column id s1 s2 x y z;
define id / order;
define x / display;
define y / display;
define z / display;
define s1 / noprint order;
define s2 / noprint order;
break after id / skip;
compute before s1;
ss1=s1;
endcomp;
compute before s2;
ss2=s2;
endcomp;
compute after id;
line @1 's1=' ss1 best4. + 1 's2=' ss2 best4.;
endcomp;
run;
On Wed, Apr 16, 2008 at 6:42 PM, Ya Huang <ya.huang@amylin.com> wrote:
> Hi there,
>
> Haven't used proc report for a while. I am stumped by this supposedly
> very simple code. In the data, s1 and s2 are constant for each id.
>
> data xx;
> input id x y z s1 s2;
> cards;
> 1 23 45 32 2.1 0.5
> 1 45 67 43 2.1 0.5
> 2 33 75 62 5.1 0.6
> 2 25 37 33 5.1 0.6
> ;
>
> options nocenter;
> proc report nowd headline;
> column id s1 s2 x y z;
> define id / order;
> define x / display;
> define y / display;
> define z / display;
> define s1 / noprint;
> define s2 / noprint;
> break after id / skip;
> compute after id;
> line @1 's1=' s1 best. @10 's2=' s2 best.; endcomp; run;
>
> id x y z
> ------------------------------------------
> 1 23 45 32
> 45 67 43
> s1= s2=
>
> 2 33 75 62
> 25 37 33
> s1= s2=
>
> My question: Why s1 and s2 are not showing up?
>
> Thanks
>
> Ya
>