BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have the following code for proc tabulate:

ods tagsets.ExcelXP style=sasweb2 file='c:\PC_SAS\Balance_Generation_Final.xls'
options( default_column_width='12, 12, 12, 12, 12'
sheet_interval='none' sheet_name='Total Summary' frozen_rowheaders='yes' rules='yes');
proc tabulate data=bal_gen_calc order=data;
where _type_ in (0,29); title;
class campaign_type term rate dte;
classlev Dte;
var tran_amt apr offer_term;
table Campaign_Type,
term *rate *(tran_amt*f=dollar15. apr*f=percent10.2 offer_term)* SUM='',
Dte / box={label=_PAGE_ s=[background=white]};
label tran_amt='Balances';
run;quit;

I would like to see the grand totals at the bottom of the table for tran_amt,apr,offer_term. Any ideas on how to do that? APR is a percentage.
4 REPLIES 4
Peter_C
Rhodochrosite | Level 12
please could you provide a small sample file like the file
data=bal_gen_calc
Cynthia_sas
SAS Super FREQ
Hi,
Generally, grand totals in PROC TABULATE come through the use of the ALL universal class variable. So I might expect to see something like this in your TABLE statement:
[pre]
table Campaign_Type,
term *rate *(tran_amt*f=dollar15. apr*f=percent10.2 offer_term)* SUM='' all*(tran_amt*f=dollar15. apr*f=percent10.2 offer_term)* SUM='',
Dte all
/ box={label=_PAGE_ s=[background=white]};

[/pre]

You could even have Campaign_Type ALL, in your TABLE statement, but you said you wanted the grand totals at the bottom of each table, not at the bottom of each page dimension.

cynthia
deleted_user
Not applicable
That worked! Thank you.

Once I add the totals to the bottom, how do I specify which I want summed verses a just showing a percentage?

For example: The tran_amt needs to be summed, but the APR and offer_term do not(they are percentages). The all step I am using now sums all 3 which leaves me with large % totals.

Any way to not have all 3 sum?
Cynthia_sas
SAS Super FREQ
Hi:
Take apr and offer_term out of the all*() parentheses and just leave tran_amt inside the parentheses.

cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 4 replies
  • 1169 views
  • 0 likes
  • 3 in conversation