Trying to create a table like this:
Region | Gender | Number |
A | f | 2 |
m | 2 | |
B | f | 2 |
m | 2 | |
C | f | 2 |
m | 2 | |
Total | f | 6 |
m | 6 |
Have tried this, but not getting the total by gender (last two rows in the table)
proc report data=final style(summary)=header;
column region gender n;
define region/group style (column)=Header;
define gender/group;
define n / 'Total';
break after region / summarize ;
rbreak after/summarize;
run;
Thanks
Hi:
PROC REPORT will not give you a total line like you want without manipulating the data in advance or perhaps using a more advanced COMPUTE block. But PROC TABULATE will easily do what you want:
Hope this helps,
Cynthia
Hi:
PROC REPORT will not give you a total line like you want without manipulating the data in advance or perhaps using a more advanced COMPUTE block. But PROC TABULATE will easily do what you want:
Hope this helps,
Cynthia
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.