| Date: | Fri, 30 Sep 2005 11:29:54 -0400 |
| Reply-To: | "Gerstle, John" <yzg9@CDC.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Gerstle, John" <yzg9@CDC.GOV> |
| Subject: | Re: tabulate traffic lighting |
|
| Content-Type: | text/plain; charset="us-ascii" |
Quentin,
Try this (a version of this worked in v8):
proc format ;
value traff low - .8 = red
.8 <- high = yellow;
run;
>> proc tabulate data=foo missing;
>> class site arm year;
classlev arm / style=[background= traff. ];
>> var active;
>> tables (site all='Total')
>> ,arm*year*active=' '
>> *(mean='% Active') }
>> ;
>> run;
>>
>> proc report data=foo nowd missing;
>> column site arm,year,active ;
>>
>> define site /group ;
>> define arm /across format= traff. ;
>> define year /across ;
>> define active /analysis '%' mean f=8.2 ;
>>
> run;
Proc Tabulate always gets me -especially trying to format specific bits.
I like Proc Report over Tabulate because it seems for straight forward.
John Gerstle, MS
Biostatistician
CDC Information Technological Support Contract (CITS)
NCHSTP \DHAP \HICSB \Research, Analysis, and Evaluation Section
"Don't worry about the world coming to an end today. It's already
tomorrow in Australia." (Charles Schultz)
>> -----Original Message-----
>> From: owner-sas-l@listserv.uga.edu
[mailto:owner-sas-l@listserv.uga.edu]
>> On Behalf Of Quentin McMullen
>> Sent: Thursday, September 29, 2005 9:56 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Cc: Quentin McMullen
>> Subject: tabulate traffic lighting
>>
>> Hi All,
>>
>> Below tabulate code makes a table showing study retention rate by
study
>> arm
>> and study year. Good enough. But I want to add traffic lighting.
Below
>> code highlights all cells with retention <80%. The catch is, what I
want
>> to
>> do is highlight cells with retention <80% at year 1, but at year 2
>> highlight
>> cells with retention <75%. So I want to use 2 different traffic
lighting
>> formats, depending on the value of year. Is this possible? I want
to
>> avoid
>> creating separate variables for active_yr1 active_yr2.
>>
>> Below code generates data, shows a tabulate step with the single
cutpoint
>> for retention highlighting. If this would be easier to do with
report,
>> I've
>> also included an attempt at that (didn't get too far : ).
>>
>> data foo;
>> do Site=1 to 5;
>> do Arm=1 to 2;
>> do _i=1 to 50;
>> id++1;
>> do Year=1 to 2;
>> active=ranuni(1)<.8;
>> output;
>> end;
>> end;
>> end;
>> end;
>> drop _:;
>> run;
>>
>> proc format;
>> value traff
>> low-<.8='red'
>> .8-high='yellow'
>> ;
>> run;
>>
>> ods rtf file="%sysfunc(pathname(work))\foo.rtf";
>> proc tabulate data=foo missing;
>> class site arm year;
>> var active;
>> tables (site all='Total')
>> ,arm*year*active=' '
>> *(mean='% Active')*{style=[background=traff.]}
>> ;
>> run;
>>
>> proc report data=foo nowd missing;
>> column site arm,year,active ;
>>
>> define site /group ;
>> define arm /across ;
>> define year /across ;
>> define active /analysis '%' mean f=8.2 ;
>>
>> /* not even close to working !;
>> compute active;
>> if _c2_<.8 then
>> call define(_col_,'style','style=[background=red]');
>> else call define(_col_,'style','style=[background=yellow]');
>> endcomp;
>> */
>> run;
>>
>> ods rtf close;
>>
>> Kind Regards,
>> --Quentin
|