BookmarkSubscribeRSS Feed
Sandhya
Fluorite | Level 6
Hi,

I have a dataset which is ODSed to EXCEL.

The dataset looks like this.

Group Panel Value Mean
111 c 11.11 22.22
111 c 12.12 21.21
111 b 13.13 13.45
222 a 45.45 56.56
222 d 77.77 77.77
222 d 88.55 66.66
..........

Now I need to color the dataset in which respect to Panel.

Meaning all panel c's under 111 gets a color, all panel b's under 111 get a different color.

Please give me suggestions.

Thanks in advance,
Sandhya.
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
I'm confused by your description of what you want. Your data/report looks like this:
[pre]
Group Panel Value Mean
111 c 11.11 22.22 <---pink
111 c 12.12 21.21 <---pink
111 b 13.13 13.45 <---yellow
222 a 45.45 56.56 <--- what color for these???
222 d 77.77 77.77
222 d 88.55 66.66
[/pre]

Are you saying that for group 111, when panel = c you want one color??? And then for Group=111 and panel=b, you want a different color??

And then WHAT do you want to color??? the panel cell??? You want to color the group cell and the panel cell??? Or you want to color the whole row???

Also, you indicate that you are using ODS to create a file that Excel can open...but are you using:
ODS CSV
ODS HTML
ODS MSOFFICE2K
ODS TAGSETS.EXCELXP?????

And, also, what is your procedure of choice?? Are you using PROC PRINT, PROC REPORT, PROC TABULATE?????

cynthia
Warren
Obsidian | Level 7
I have a similar question. I need to create a excel spreadsheet with a light green color for the whole row whenever desc = 'diff' as well as the title row. What should I do? Please see code below.

data diff(keep=n desc m2 m1 m0);
merge a b;
by n;
dm2 = sum(m2 , -bm2);
dm1 = sum(m1 , -bm1);
dm0 = sum(m0 , -bm0);
if abs(dm2 ) > 2
or abs(dm1 ) > 2
or abs(dm0 ) > 2;
output;
desc = bdesc;
m2 = bm2;
m1 = bm1;
m0 = bm0;
output;
desc = 'diff';
m2 = dm2;
m1 = dm1;
m0 = dm0;
output;
run;

proc export data=diff
outfile="c:\diff.xls"
dbms=excel2000 replace;
run;

Thanks.

Warren
Cynthia_sas
SAS Super FREQ
Hi,
The issue is that there are no colors and fonts in a SAS dataset. So with PROC EXPORT there are no ways to highlight or do traffic lighting or conditional highlighting.

If you use ODS and PROC REPORT then you can highlight a whole row based on a condition, using the CALL DEFINE statement in a COMPUTE block.

There are examples in previous forum postings if you search for traffic lighting or conditional highlighting, as well as in the PROC REPORT documentation.

Cynthia
Warren
Obsidian | Level 7
I've found that I can use ods tagsets.excelxp with proc report and the following compute statement.

compute src;
if src = 'diff' then call define(_row_, "style", "style={foreground=blue}");
endcomp;

See also http://support.sas.com/kb/23/353.html

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1220 views
  • 0 likes
  • 3 in conversation