Dear SAS community, I've recently started to use proc report and I can't figure out how to change the background color of different line statements. I am using SAS Studio. The code below highlights Acura a light green color and BMW a yellow color. I need my data to look like this where the group make is like a header. The texts line1, line2, line3, and line4 are placeholders that will contain something else. data test1; set sashelp.cars;
dummy=1;
if make in ("Acura" "BMW");
run;
ods escapechar="^";
proc report data=test1 out=rep1;
columns make model msrp,type dummy;
define make / group noprint;
define model / group ;
define type / across "";
define msrp / display "MSRP";
define dummy / sum noprint;
compute before _page_ / style=[fontsize=13pt just=l];
line "line1";
line "line2";
endcomp;
compute before make / style=[just=left];
length text $100;
if make = "Acura" then
text = " ^{style[font_size=13pt font_weight=bold background=lightgreen]" ||strip(make)|| "}";
if make ="BMW" then
text = " ^{style[font_size=13pt font_weight=bold background=yellow]" ||strip(make)|| "}";
line @0 text $100.;
endcomp;
compute after / style=[fontsize=13pt just=left];
line "line3";
line "line4";
endcomp;
run; The above code produces the output below. I want the background of Acura and BMW to look like below except I want them to have different colors. For example, I want Acura to be light green and BMW to be yellow. If I use style(lines) in proc report to change the background, it will also affect the background color of line1, line2, line3, and line4. How can I make my data look like the screenshot below except the make group has different colors? Doing a call define (_row, "style", "style=[background=yellow") does not seem to work. I would also like to know how I can do it if I have more than 2 different groups. I will be ods pdf for this data. proc report data=test1 out=rep1;
columns make model msrp,type dummy;
define make / group noprint;
define model / group ;
define type / across "";
define msrp / display "MSRP";
define dummy / sum noprint;
compute before _page_ / style=[fontsize=13pt just=l];
line "line1";
line "line2";
endcomp;
compute before make / style=[just=left backgroundcolor=yellow];
length text $100;
if make = "Acura" then
text = " ^{style[font_size=13pt font_weight=bold]" ||strip(make)|| "}";
if make ="BMW" then
text = " ^{style[font_size=13pt font_weight=bold]" ||strip(make)|| "}";
line @0 text $100.;
endcomp;
compute after / style=[fontsize=13pt just=left];
line "line3";
line "line4";
endcomp;
run; I want Acura to have a light green background color and BMW to have a yellow background color. The background for line1, line2, line3, and line4 should be as it is. Thank you for the help.
... View more