LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 17 Apr 2008 11:20:40 -0400
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Re: Simple proc report question
Comments: To: Dennis Diskin <Dennis.Diskin@PHARMA.COM>

Thanks Dennis and _null_.

I now recall that one can only use a variable for this kind of thing when it is on the left of the break var. My code didn't work, probably because that s1 and s2 are on the right hand side of break var id.

_null_'s trick has the advantage of not having to be on the left of break var.

On Thu, 17 Apr 2008 10:30:11 -0400, Diskin, Dennis <Dennis.Diskin@PHARMA.COM> wrote:

>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 >>


Back to: Top of message | Previous page | Main SAS-L page