Hi , I am new with proc tabulate . I have a dataset below
CRM_E1 | COUNT | PERCENT |
0 | 1.03E+08 | 98.4695 |
1 | 953055 | 0.91539 |
2 | 195485 | 0.187759 |
3 | 136225 | 0.130841 |
4 | 107446 | 0.1032 |
5 | 96704 | 0.092882 |
6 | 104559 | 0.100427 |
I need to format the below with some custom format color and total at the end. Resultant output is attached. Can this be done by proc tabulate or proc report
You need to assign the desired formats to variables count and percent by using the FORMAT statement in PROC TABULATE. Here is an example: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=proc&docsetTarget=p13k5zc...
This is one way maybe:
data have; input CRM_E1 :$5. COUNT PERCENT; datalines; 0 1.03E+08 98.4695 1 953055 0.91539 2 195485 0.187759 3 136225 0.130841 4 107446 0.1032 5 96704 0.092882 6 104559 0.100427 ; proc report data=have; columns CRM_E1 COUNT PERCENT; define crm_e1/"E1 value" style(header)=[background=cyan] group ; ; define COUNT/"Count" style(header)=[background=cyan]; define PERCENT/"Percent" style(header)=[background=cyan]; rbreak after / summarize style=[background=cyan fontweight=bold]; compute after; crm_e1='Total'; endcomp; run;
If your crm_e1 variable is not character you will have some issues getting a character "Total" in a column expecting numeric values.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.