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 (May 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 20 May 2009 10:57:03 +0100
Reply-To:   Anna Larbalestier <anna.larbalestier@BRISTOL.AC.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Anna Larbalestier <anna.larbalestier@BRISTOL.AC.UK>
Subject:   Re: Conditional Formatting using Call Define in proc report
Comments:   To: Virtual SAS Users Group <sfbay0001@AOL.COM>
In-Reply-To:   <da571475-c019-4fab-9c69-b7078ff42a17@b1g2000vbc.googlegroups.com>
Content-Type:   text/plain; charset=UTF-8; format=flowed

Thanks very much - using an example in your presentation I now have it working.

Virtual SAS Users Group wrote: > I am running to the airport to catch a flight and don't have time to > write a lot in reply to your poist. > > However, I am wondering if any of the examples in my paper "Traffic > Lighting Your Reports the Easy Way with PROC REPORT and ODS," > available from the "Free Downloads" link at http://www.sierrainformation.com > might have some solutions for you. Why don't you check it out? > > Thanks, > > Andrew Karp > > > On May 20, 4:57�am, anna.larbalest...@BRISTOL.AC.UK (Anna > Larbalestier) wrote: > >> Dear SAS-L >> >> I'm creating a listing, where I need to shade certain observations in >> grey and leave the others as white. �Where flag = 1, the observation >> should be shaded grey, and where flag=0 the background should remain >> white. �I'm trying to do this using the call define statement in proc >> report (I don't have to do it this way, but I didn't know another way). >> In the example data below, I've just set every other observation to have >> flag =1, but in my real data this is not the case. � �My code is below, >> it produces the listing exactly as I want except for my grey shading. >> >> data class; >> � set sashelp.class; >> count = _n_; >> if mod(count,2)=0 then flag = 1; >> else flag = 0; >> run; >> >> options nodate orientation=landscape missing=" " nobyline; >> ods escapechar='^'; >> >> ods listing close; >> ods rtf file = "sashelp.rtf" style = journal1 bodytitle sasdate ; >> >> title1 "SAS Help Example Listing"; >> >> proc report data = class nowd missing split="#"; >> columns flag count name sex age height weight; >> define count � � � � � � � � � � / order order = internal noprint; >> define flag � � � � � � � � � � �/ display noprint; >> define name � � � � � � � � � � �/ order order=data 'Name' >> style(column)=[just=l cellwidth=1in]; >> define sex � � � � � � � � � � � / order order=data 'Sex' >> style(column)=[just=c cellwidth=.5in]; >> define age � � � � � � � � � � � / display 'Age' style(column)=[just=l >> cellwidth=.5in]; >> define height � � � � � � � � � �/ display 'Height' >> style(column)=[cellwidth=.5in just=l]; >> define weight � � � � � � � � � �/ display 'Weight' flow >> style(column)=[just=l cellwidth=.5in]; >> /*ODS tagsets - creates a line after every subject.*/ >> compute after name; >> line '^R/RTF"\brdrb\brdrs\brdrw15"'; >> endcomp; >> /*Shade flagged observations in grey*/ >> compute after count; >> � if flag = 1 then call define (_ROW_,"style","style=[background=ltgray]"); >> endcomp; >> run; >> >> title; >> footnote; >> ods rtf close; >> ods listing; >> >> I'm running SAS 9.1 on XP PRO. >> >> I would be very grateful for any suggestions as to how I can make this work. >> >> Thank-you >> >> Anna >> >> PS. >> The style template journal1 is one that I have defined. �I've included >> it here below in case that's what is causing the problem. >> >> proc template; >> define style Styles.Journal1; >> � �parent = styles.journal; >> � �replace fonts / >> � � � 'SASTitleFont' = ("Arial, Helvetica, Helv",2,Bold ) >> � � � 'TitleFont2' = ("Arial, Helvetica, Helv",2,Bold ) >> � � � 'TitleFont' = ("Arial, Helvetica, Helv",2,Bold ) >> � � � 'StrongFont' = ("Arial, Helvetica, Helv",2,Bold ) >> � � � 'EmphasisFont' = ("Arial, Helvetica, Helv",2,Bold) >> � � � 'FixedEmphasisFont' = ("Courier New, Courier",2,Bold ) >> � � � 'FixedStrongFont' = ("Courier New, Courier",2,Bold) >> � � � 'FixedHeadingFont' = ("Courier New, Courier",2,Bold) >> � � � 'FixedFont' = ("Courier New, Courier",2) >> � � � 'headingEmphasisFont' = ("Arial, Helvetica, Helv",2,Bold Bold) >> � � � 'headingFont' = ("Arial, Helvetica, Helv",2,Bold) >> � � � 'docFont' = ("Arial, Helvetica, Helv",2); >> � �replace Data from Cell / >> � � � font = Fonts('DocFont') /*normal table cells*/ >> � � � foreground = colors('fg3') >> � � � background = colors('bg3') >> � � � just = R; >> � �replace HeadersAndFooters from Cell / >> � � � font = fonts('HeadingFont'); >> � � �replace Output from Container / >> � � � background = colors('bgA1') >> � � � rules =groups >> � � � frame = HSIDES >> � � � cellpadding = 3 >> � � � cellspacing = 0 >> � � � borderwidth = 1 >> � � � bordercolor = colors('fgA1'); >> � � � replace Header / >> � �FONT_FACE = "Arial, Helvetica, Helv" >> � �FONT_SIZE = 2 >> � �FONT_WEIGHT = bold >> � �FONT_STYLE = roman >> � �just = L; >> � � �replace Body from Document >> � � � "Controls the Body file." / >> � � � rightmargin = .75in >> � � � leftmargin = .75in >> � � � topmargin = .5in >> � � � bottommargin = .5in; >> � � � style PageNo from PageNo/ >> � � � font_size=0.1pt >> � � � background=white >> � � � foreground=white; >> � �replace TableHeaderContainer from Container >> � � � " Box around all column headers. " / >> � � � abstract = on >> � � � borderwidth=5; >> �end; >> run; >>


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