I want to create a table as below. But I have difficulties to make it look exactly same as the sample below.
First, how to make the first column? It lists the variable name first, from the left, then lists the categories for this variable but a little space from the left. For example, Gender (N, %) first and from the very left, then Male, Female following next but a little space from left?
Second, how to make the headers looks like this, first line Demographics, then second line Treatment Group A, Treatment Group B, third line Strata 1, 2, 1, 2....
I really have no idea how to make it. Thanks in advance~

The trick is getting your data in the right format. Then you can use proc report to generate the table either directly to a word or PDF file.
See this paper for starters.
Thanks very much~
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.