The SAS Output Delivery System and reporting techniques

How to highlight a column

Accepted Solution Solved
Reply
Contributor
Posts: 32
Accepted Solution

How to highlight a column

I want to highlight Weight column in excel output.

  •   when Weight is less than Height .

 

/*SAS code*/

ods tagsets.excelxp file="bylines.xls" style=statistical

options( suppress_bylines='yes' sheet_interval='none' );

proc report data=class nowd;

column name age sex height weight ;

define name / display;

define age / display;

define sex / order;

define height / sum;

define weight / sum;

compute age;

if age < 13 then  call define(_col_,"style","style={background=red}");

endcomp;

compute weight;

if weight < height then call define(_col_,"style","style={background=blue}");

endcomp;

run;

ods _all_ close;

 

Thanks.


Accepted Solutions
Solution
‎09-08-2016 09:47 AM
Grand Advisor
Posts: 9,576

Re: How to highlight a column

Since weight and height has ANALYSIS usage, you should use .sum to refer to them.


compute weight;
if weight.sum < height.sum then call define(_col_,"style","style={background=blue}");
endcomp;

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,719

Re: How to highlight a column

Hi:
I would expect that you are getting highlighting for AGE, but not for the WEIGHT column. When you use an analysis variable in a COMPUTE block, you do not refer to the simple name. You must use the convention varname.statistic.

So in this case, you show that statistic of SUM for HEIGHT and WEIGHT, then you need to refer to them in your COMPUTE block as:
HEIGHT.SUM and WEIGHT.SUM

or

if weight.sum < height.sum then call define(...);

cynthia
Contributor
Posts: 32

Re: How to highlight a column

It works.

 

Thanks

kesete

Solution
‎09-08-2016 09:47 AM
Grand Advisor
Posts: 9,576

Re: How to highlight a column

Since weight and height has ANALYSIS usage, you should use .sum to refer to them.


compute weight;
if weight.sum < height.sum then call define(_col_,"style","style={background=blue}");
endcomp;
Contributor
Posts: 32

Re: How to highlight a column

It works,

 

Thanks,

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 289 views
  • 1 like
  • 3 in conversation