BookmarkSubscribeRSS Feed
BrianB4233
Obsidian | Level 7

Hello,

So I've finally settled on a table style using PROC TABULATE, and I'm happy with it.However it's labor intensive and prone to syntax errors when applying to > 1 table. Here's what I've come up with:

 

%let header1 = style=[color=black font_size=10pt font_weight=bold font_face=calibri];
%let header2 = style=[color=black font_size=10pt font_weight=medium font_face=calibri];
%let table1 = [s={color=black font_size=10pt font_weight=medium font_face=calibri just=center}];
%let table2 = [s={color=black font_size=10pt font_weight=bold font_face=calibri just=center}];

ods listing close;
ods excel file = "C:mydocuments\table1.xlsx";

ods excel options(sheet_name="Aim1 - 22Apr2019"
sheet_interval='none'
embedded_titles="no"
embedded_footnotes="no"
);

proc odstext;
p "Aim 1 - Income x AFQT Descriptive Analysis"/ &header1;
p "Program location: P:\ORD_Tarlov_201810058D\SAS Programs & Logs\Aim 1" / &header2;

proc tabulate data = afqt_vetses missing;
class afqt_score_cat / &header1;
classlev afqt_score_cat / &header2;
var afqtperc / &header1;
tables afqt_score_cat*&table1 all*&table2,
afqtperc*(n*f=comma12. mean std q1 median q3 min max) / nocellmerge box={label="Sample B: Task 1" s={color=black font_size=10pt font_weight=bold font_face=calibri}};
keylabel all='Total';
keyword all n mean std q1 median q3 min max / &header1;
;
run;

ods excel close;

However, there are 9 more of these tables I need to output that are slight variations of the this one. Is there a more global way I can apply these styles rather than this way which seems so cumbersome? Thanks much.

1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi: You could do a custom STYLE template. By default all headers are bold, so technically, you only need to change the headers to medium where you want them to be medium. The headers for the COLUMN dimension are controlled by the HEADER style element. The headers in the ROW area are controlled by the ROWHEADER style element. The data cells are controlled by the DATA element. You will probably always need to put your style on the KEYWORD statement inside TABULATE.

Cynthia

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!

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
  • 1 reply
  • 533 views
  • 0 likes
  • 2 in conversation