BookmarkSubscribeRSS Feed
ss171
Calcite | Level 5

Hi , I am new with proc tabulate . I have a dataset below 

CRM_E1COUNTPERCENT
01.03E+0898.4695
19530550.91539
21954850.187759
31362250.130841
41074460.1032
5967040.092882
61045590.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 Capture.PNG

2 REPLIES 2
PaigeMiller
Diamond | Level 26

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...

--
Paige Miller
ballardw
Super User

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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 579 views
  • 2 likes
  • 3 in conversation