Date: Tue, 31 Jul 2007 15:18:56 -0500 Reply-To: "data _null_;" Sender: "SAS(r) Discussion" From: "data _null_;" Subject: Re: Tip: DEFINE multiple-items in PROC REPORT Comments: To: Mike Rhoads In-Reply-To: <403593359CA56C4CAE1F8F4F00DCFE7D07295984@MAILBE2.westat.com> Content-Type: text/plain; charset=ISO-8859-1 I find the colon quite useful in DEFINE. define DISP: / display width=....; On 7/31/07, Mike Rhoads wrote: > This may be another in the "maybe everyone knew this but me" series, but > just in case ... > > I was struck when looking at a recent post by Jack Hamilton (below) that > he used a variable list in the DEFINE statement of PROC REPORT: > > define _all_ / display; > > I don't remember ever seeing this before, but it could certainly be > useful in certain contexts, such as Jack's example. I tried a few more > variations (e.g. define value--displayed ...) that also worked. > > Is this referenced in some SAS examples somewhere, or maybe in Art's > book? The official 9.1.3 documentation certainly doesn't imply that you > can do this: > > "report-item -- specifies the name or alias (established in the COLUMN > statement) of the data set variable, computed variable, or statistic to > define." (singular, not plural) > > Mike Rhoads > Westat > RhoadsM1@Westat.com > > -----Original Message----- > From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] > On Behalf Of Jack Hamilton > Sent: Tuesday, July 31, 2007 3:37 PM > To: data _null_; > Cc: SAS-L@LISTSERV.UGA.EDU > Subject: Re: [SAS-L] PROC REPORT formatting > > > I think it's a variable order problem. > > ===== > data test (keep=value displayed); > do i = 1 to 5; > value = ranuni(95605) * 10; > displayed = value; > output; > end; > stop; > run; > > proc report data=test nowindows missing nocenter; > columns value displayed; > define _all_ / display; > compute displayed; > if displayed > 8 then > call define('value', 'format', 'roman5.'); > endcomp; > run; > ===== > > prints: > > ===== > value displayed > 3.4648784 3.4648784 > 3.3165982 3.3165982 > 2.0278367 2.0278367 > VIII 8.0749122 > VIII 8.1445687 > ===== > > but > ===== > proc report data=test nowindows missing nocenter; > columns value displayed; > define _all_ / display; > compute value; > if value > 8 then > call define('displayed', 'format', 'roman5.'); > endcomp; > run; > ===== > > prints: > > ===== > value displayed > 3.4648784 3.4648784 > 3.3165982 3.3165982 > 2.0278367 2.0278367 > 8.0749122 8.0749122 > 8.1445687 8.1445687 > ===== > > > > data _null_; wrote: > > I don't think it works that way. You need compute for X1 and X2; > > > > See example below. > > > > proc report nowd headline data=sashelp.class; > > columns age name weight; > > define age / order; > > define weight / display format=z5.1 width=18; > > compute before age; > > dataStepAGE = age; > > endcomp; > > compute weight; > > if dataStepAge eq 12 then do; > > /* rc = seenum(age,'NOTE: AGE=');*/ > > /* rc = seenum(datastepAge,'NOTE: datastepAge=');*/ > > call define('weight','format','18.7'); > > end; > > endcomp; > > run; > > > > On 7/31/07, Paige Miller wrote: > >> I would like to change the formatting of certain rows in PROC FORMAT. > >> Specficially, if a variable named PASS108 has the value 3, I want to > >> assign different formats to columns X1 and X2 in that row. > >> > >> Here's what I have tried: > >> > >> compute after pass108; > >> if pass108=3 then do; > >> call define('x1','format','pvalue6.4'); > >> call define('x2','format','pvalue6.4'); > >> end; > >> endcomp; > >> > >> Now, I'm sure my error is something simple, but I just can't figure > it > >> out. Someone please enlighten me. Thanks. > >> > >> -- > >> Paige Miller > >> paige\dot\miller \at\ kodak\dot\com > >> > 

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