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 (July 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 7 Jul 2008 09:42:21 -0700
Reply-To:     Andrew H Karp <sfbay0001@AOL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Andrew H Karp <sfbay0001@AOL.COM>
Organization: http://groups.google.com
Subject:      Re: Question about proc report
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=UTF-8

Hi...you might want to look at my paper (available for free download as a PDF) "Traffic Lighting Your Reports the Easy Way with PROC REPORT and ODS". Just go to http://www.sierrainformaton.com and click on the "user group presentations" link on the left hand side of the page.

Hope this helps...

Andrew Karp Sierra Information Services www.SierraInformation.com

On Jul 5, 6:21�pm, j...@STANFORDALUMNI.ORG (Jack Hamilton) wrote: > Wgen asking a question, you should provide sample data illustrating > the problem. �Also, something has put funny characters into your code. > > Here's working code: > > ===== > data test; > � � input student $ mathscore1 mathscore2 readingscore1 readingscore2; > cards; > A 1 1 2 3 > A 4 4 5 5 > B 6 7 8 8 > ;;;; > proc report data=test nowindows; > � � column student mathscore1 mathscore2 readingscore1 readingscore2; > � � define student / order; > � � define mathscore1--readingscore2 / display; > � � compute mathscore2; > � � � �if mathscore1 ne mathscore2 then > � � � � � call define(_col_, 'style', 'style=[background=pink]'); > � � endcomp; > run; > ===== > > There were two problems with what you did: > > 1) COMPUTE blocks can refer only to variables to the LEFT of the > current variable, so a compute block for mathscore1 can't successfully > use the value of mathscore2. > > 2) By default (and explicitly in your case), numeric variables are > analysis variables, not display variables. �To refer to an analysis > variable in a compute block, you must include the statistic name. > > This would also work: > > ===== > proc report data=test nowindows; > � � column student mathscore1 mathscore2 readingscore1 readingscore2; > � � define student / order; > � � define mathscore1--readingscore2 / sum; > � � compute mathscore2; > � � � �if mathscore1.sum ne mathscore2.sum then > � � � � � call define(_col_, 'style', 'style=[background=pink]'); > � � endcomp; > run; > ===== > > But since SUM is usually used when you are summarizing groups, and it > appears that you want a detail report, you probably want to use my > first code example to avoid later confusion. > > -- > Jack Hamilton > j...@alumni.stanford.org > > On Jul 5, 2008, at 2:33 pm, Sarah Cox wrote: > > > > > Hi, all, > > > I am trying to highlight the cells in the report using PROC REPORT. > > Here is > > the situation. �Suppose I have two math and reading tests for one > > student: > > mathScore1, mathScore2, ReadingScore1, ReadingScore2. IF any > > mathScore1 not > > equal to MathScore2, I will highlight both valuee. Same as Reading. > > Following is the code I wrote: > > > * > > > proc* *report* data=*test* nowd split="\"; > > > column *student* *mathScore1 mathScore2 ReadingScore1 ReadingScore2*; > > > define *s*tudent / order; > > > define *mathscore1*/ analysis; > > > define *mathscore2*/ analysis; > > > define *readingscore1* / analysis; > > > define *readingscore2* / analysis; > > > compute *mathscore1;* > > > if *mathscore1* ne *mathscore2* then do; > > > call define (_col_, "style*"**,* "style=[background=pink]"); > > > end; > > > endcom*p;* > > > ** > > > *But the log keeping saying the two variables are not initialized:* > > * > > > NOTE: Variable mathscore1 is uninitialized. > > > NOTE: Variable mathscore2 is uninitialized. > > * > > > *Would any expert advise me what's wrong with my logic or code? Really > > appreciate your help!* > > > ** > > > *Sarah Cox* > > > **- Hide quoted text - > > - Show quoted text -


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