Hi all-
I am looking to apply "traffic lighting" to a column-There are two parts to the coloring scheme-
One is percentage-over 95% is blue, and under 95% is red-that part works-
However there is another value,colorscheme, that if 0 then I want to grayed it out-This has nothing to due with the value of compliance but rather is set on whether enough audits were done.
The Data looks like this:
FAC compliance colorscheme
A 97 1
B 90 1
C . 0
D 99 0
Some of the pertinet code follows below-
Thank you again-
Lawrence
Proc format;
Value sigb
low-<0.94500='red'
<=0.945000-high='blue';
Value sigc
low-<0.94500='black'
<=0.945000-high='white';
run;
ods escapechar="\";
ods graphics on/height=2.75in width=7in;
options nodate nonumber center leftmargin=1in rightmargin=1in topmargin=1in bottommargin=1in;
ods pdf file='P:\c dif dash1.pdf' style=styles.MyStyle;
ods pdf anchor="page1";
proc report data=measures headline headskip nowd spanrows style(report)={font_size=7pt cellpadding=.3pt cellspacing=.5pt }
style(column) = {font = ("arial",7pt)};;
columns facility ('ROOM CLEANING' COMPLIANCE COLORSCHEME);
DEFINE FACILITY/' ' format=$code. order style={linkcolor=black background=lightgray color=blue borderrightwidth=0 borderleftwidth=0 borderbottomwidth=0 bordertopwidth=0 };;
DEFINE COMPLIANCE/XXX' format=percent10. style={background=sigb. color=sigc.};
DEFINE colorscheme/ analysis noprint;
compute facility;
urlstring=compress("#"||facility);
call define(_COL_,'url',urlstring) ;
endcomp;
compute compliance;
if colorscheme.sum=0 then call define(_COL_,'style','style={background=gray color=black}');
else if FACILITY in ('ZTO','ZZC') then call define(_ROW_,'style','style={background=lightgray color=black}');
endcomp;
run;
Hi:
You are running into what I call the "left to right" rule of PROC REPORT. If you wish to use COLORSCHEME in the COMPUTE block for COMPLIANCE, then you must put COLORSCHEME before COMPLIANCE in your COLUMN statement.
PROC REPORT does not have a PROGRAM DATA VECTOR (PDV). It only has the report row that it is currently building. So think of PROC REPORT as "plopping down" one report item at a time working from left to right, based on the items in your COLUMN statement. If COLORSCHEME comes after COMPLIANCE on the COLUMN statement, then COMPLIANCE gets "plopped down" first.
columns facility ('ROOM CLEANING' COMPLIANCE COLORSCHEME);
Your current COLUMN statement has COMPLIANCE "plopping" first, then COLORSCHEME "plopping next. So, when COMPLIANCE plops down on the report row, the COMPUTE block for COMPLIANCE gets executed. At that particular point in time, no "plopping" for COLORSCHEME has happened yet. PROC REPORT only has visibility of what's been "plopped" which, given your COLUMN statement, is FACILITY and COMPLIANCE. So the COMPUTE block for COMPLIANCE has no (repeat NO) visibility of the value for COLORSCHEME, because COLORSCHEME hasn't "plopped" yet.
Since COLORSCHEME is a NOPRINT item, it should not matter whether it is placed on the COLUMN statement before or after COMPLIANCE -- but if you want to use it to set anything within the COMPUTE block for COMPLIANCE, consider changing your COLUMN statement to:
columns facility ('ROOM CLEANING' COLORSCHEME COMPLIANCE );
cynthia
Hi:
You are running into what I call the "left to right" rule of PROC REPORT. If you wish to use COLORSCHEME in the COMPUTE block for COMPLIANCE, then you must put COLORSCHEME before COMPLIANCE in your COLUMN statement.
PROC REPORT does not have a PROGRAM DATA VECTOR (PDV). It only has the report row that it is currently building. So think of PROC REPORT as "plopping down" one report item at a time working from left to right, based on the items in your COLUMN statement. If COLORSCHEME comes after COMPLIANCE on the COLUMN statement, then COMPLIANCE gets "plopped down" first.
columns facility ('ROOM CLEANING' COMPLIANCE COLORSCHEME);
Your current COLUMN statement has COMPLIANCE "plopping" first, then COLORSCHEME "plopping next. So, when COMPLIANCE plops down on the report row, the COMPUTE block for COMPLIANCE gets executed. At that particular point in time, no "plopping" for COLORSCHEME has happened yet. PROC REPORT only has visibility of what's been "plopped" which, given your COLUMN statement, is FACILITY and COMPLIANCE. So the COMPUTE block for COMPLIANCE has no (repeat NO) visibility of the value for COLORSCHEME, because COLORSCHEME hasn't "plopped" yet.
Since COLORSCHEME is a NOPRINT item, it should not matter whether it is placed on the COLUMN statement before or after COMPLIANCE -- but if you want to use it to set anything within the COMPUTE block for COMPLIANCE, consider changing your COLUMN statement to:
columns facility ('ROOM CLEANING' COLORSCHEME COMPLIANCE );
cynthia
Cynthia-
That helped immensely! Thank you!
One other quick question-I think you said before that there was no way to change the the thickness of the lines concerning URL strings-I have attempted using border thickness as an option to no avail!
Is there a way to change it in a template somewhere...
Thanks again.
Lawrence
My understanding is that each destination shows URLs based on some internal settings. I don't believe there's any way you can impact the display of the URL strings. In PDF, you are able to alter the "blue box" around the link by specifying LINKCOLOR, as described here: http://support.sas.com/kb/24/182.html ... but I don't think that extends to the thickness of the line around the link, since it's an internal PDF thing. If this is of burning importance, you might want to double check with Tech Support.
cynthia
Cynthia-
I am familiar with the link color but was wondering on changing the other parameters.
I can check with Tech support on this issue. Thanks for your help again.
Lawrence
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.