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 (October 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 14 Oct 2009 03:31:37 -0700
Reply-To:     Chris Jones <chrisj75@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Chris Jones <chrisj75@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: How to sofisticate ODS reports by using colors for rows and
              columns
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On 14 Oct, 06:49, Anaconda <r...@fastlane.no> wrote: > /* > Below is an example code of wrting a simple > report using ODS. > > How can I make the program so that I can mark the > records (both columns) with colour (yellow, for instance) > in those two cases where Col_02 = "wrong"? > > And how can I make SAS colour the column Col_02 > if I wanted? > > Could this be a suitable task to be handled by a macro? > Does anyone know about the existence of a such one? > > - Anaconda > */ > > data test; > attrib > Col_01 length = $15 > Col_02 length = $5 > ; > infile datalines truncover; > input > @01 Col_01 $15. > @20 Col_02 $5. > ; > datalines; > record # 1 right > record # 2 wrong > record # 3 right > record # 4 right > record # 5 right > record # 6 wrong > record # 7 right > ; > run; > > %macro print; > ods listing close; > ods escapechar = '^'; > ods rtf file = "d:\temp\test.doc"; > proc print data = test noobs; > run; > ods rtf close; > %mend; > %print;

Use PROC REPORT and a compute block : ods listing close; ods escapechar = '^'; ods rtf file = "d:\temp\test.doc"; proc report data = test nowd; column col_01 col_02 compute_color ; define compute_color / computed noprint ; compute compute_color ; if col_02 = 'wrong' then call define(_row_,"STYLE","style (calldef)={background-color:yellow}"); endcomp ; run; ods rtf close;

Not tested - 'background-color' may need to be 'background'...


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