BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
CathyVI
Lapis Lazuli | Level 10

Hi,

I will like to bold the following sub-heading (Sex, Age category, Race/Ethnicity) and also remove the periods (.) each row in my proc report code. I have made multiple attempt but am not getting it. Please see my code below. Thanks in advance.

CathyVI_0-1749485244670.png

proc report data=case
style(report)=[background=white]
style(header)=[background=#919CB2 foreground=black borderstyle=hidden];
col Cat2 Y2020 Y2021 Y2022 Y2023 Y2024 Total;
define cat2/display 'Variable';
/*Make row headings bold and more readable*/ compute cat2; if cat2 in('Sex' 'Age category' 'Race/Ethnicity' ) then do; call define(_row_, "style", "style=[backgroundcolor=#DFE5E5 fontweight=bold]"); end; endcomp;
/*Make the . disappear in the row headings*/
compute count;
if cat2 in('Sex' 'Age category' 'Race/Ethnicity') then do;
call define(_col_, "style", "style=[foreground=#DFE5E5]");
end;
endcomp; run;
1 ACCEPTED SOLUTION

Accepted Solutions
Kathryn_SAS
SAS Employee

The subheadings are bold for me with sample data. Make sure that the Cat2 values in the Compute block match the actual data values. You can also try this:

compute cat2;
if strip(cat2) in('Sex' 'Age category' 'Race/Ethnicity' ) then do;
call define(_row_, "style", "style=[backgroundcolor=#DFE5E5 fontweight=bold]");
end;
endcomp;

If you continue to have problems, can you send your log and/or actual data?

View solution in original post

4 REPLIES 4
Kathryn_SAS
SAS Employee

Count is not a variable in the PROC REPORT definition. If I run your code with sample data without the Compute block for Count, those headings are bold.

Here is the revised code:

options missing=' ';
proc report data=case
style(report)=[background=white]
style(header)=[background=#919CB2 foreground=black borderstyle=hidden];
col Cat2 Y2020 Y2021 Y2022 Y2023 Y2024 Total;
define cat2/display 'Variable';

/*Make row headings bold and more readable*/
compute cat2;
if cat2 in('Sex' 'Age category' 'Race/Ethnicity' ) then do;
call define(_row_, "style", "style=[backgroundcolor=#DFE5E5 fontweight=bold]");
end;
endcomp;

/*Make the . disappear in the row headings*/
/*compute count;*/
/*if cat2 in('Sex' 'Age category' 'Race/Ethnicity') then do;*/
/*call define(_col_, "style", "style=[foreground=#DFE5E5]");*/
/*end;*/
/*endcomp;*/
run;

Which ODS destination are you using? Can you include a sample of the output?

CathyVI
Lapis Lazuli | Level 10

@Kathryn_SAS  Yes, the heading (Variable, Y2020-Y2024, Total) are bold but i want to make ('Sex' 'Age category' 'Race/Ethnicity') bold too.  I am using ods excel as destination. The snippet I posted was my output. The options missing=' '; has removed the (.) Now I want the SUB-heading; sex, age category and race/ethnicity to be bold. Thanks

ods excel file="Req/health_result.xlsx"
options(embedded_titles='yes' sheet_interval='NONE' sheet_name='Telehealth')

CathyVI_0-1749486960661.png

 

Kathryn_SAS
SAS Employee

The subheadings are bold for me with sample data. Make sure that the Cat2 values in the Compute block match the actual data values. You can also try this:

compute cat2;
if strip(cat2) in('Sex' 'Age category' 'Race/Ethnicity' ) then do;
call define(_row_, "style", "style=[backgroundcolor=#DFE5E5 fontweight=bold]");
end;
endcomp;

If you continue to have problems, can you send your log and/or actual data?

CathyVI
Lapis Lazuli | Level 10
Thank you so much. Using the strip function makes it work.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 388 views
  • 1 like
  • 2 in conversation
OSZAR »