## PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Solved
Occasional Contributor
Posts: 6

# PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Do any one know how to select columns to symmary inside PROC REPORT. I used 'RBREAK /AFTER'. It summarized all numerical variables. I want to summarize only the ones I need to. Thanks!

Accepted Solutions
Solution
‎10-11-2012 01:02 PM
SAS Super FREQ
Posts: 9,370

## Re: PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Hi:

Look in the doc at the difference between the default usage of SUM for numeric variables and the usage of DISPLAY. If you do not have DEFINE statements for your numeric variables, you will need to use a DEFINE statement so you can explicitly give a usage of DISPLAY -- this will turn off summarizing of the values at the RBREAK/BREAK. Something like:

DEFINE numvar / DISPLAY;

Without a DEFINE statement, ALL your numeric (analysis) variables have a default usage of SUM.

cynthia

All Replies
Solution
‎10-11-2012 01:02 PM
SAS Super FREQ
Posts: 9,370

## Re: PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Hi:

Look in the doc at the difference between the default usage of SUM for numeric variables and the usage of DISPLAY. If you do not have DEFINE statements for your numeric variables, you will need to use a DEFINE statement so you can explicitly give a usage of DISPLAY -- this will turn off summarizing of the values at the RBREAK/BREAK. Something like:

DEFINE numvar / DISPLAY;

Without a DEFINE statement, ALL your numeric (analysis) variables have a default usage of SUM.

cynthia

Occasional Contributor
Posts: 6

## Re: PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Thank you very much! Cynthia: It works! Is there any way I can fill in the 1st column in this row with "TOTAL"? AND re-calculate the values in other column in this summary row?

SAS Super FREQ
Posts: 9,370

## Re: PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Hi:

I'm not sure what you mean by "re-calculate the values in other columns" ... what other columns? Why not let PROC REPORT do the calculation. For example, if you want to show the MEAN at the break, you can give your variable a usage that is the statistic you want to see at the break:

DEFINE SALARY / MEAN;

or

DEFINE SALARY / N;

The first DEFINE would show the average of all salaries at the RBREAK and the second DEFINE would show the COUNT (or N).

But to get the word "Total" at the break, you would use a COMPUTE block. Something like:

COMPUTE AFTER;

firstvar = 'TOTAL';

ENDCOMP:

cynthia

Occasional Contributor
Posts: 6

## Re: PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Posted in reply to Cynthia_sas

Thank you again! Cynthia: For the 'TOTAL' thing, I used the COMPUTE block, no error, but for some reason it did not show up in the report. Do I need to put more infor somewhere to make it show up? For the 're-calculate', I need to compute the ratio from other two summaries and put it in this summary line under another column. Is that possible? Thank you so much for your help!

SAS Super FREQ
Posts: 9,370

## Re: PROC REPORT --- SUMMARY IN SEPCIFIC COLUMNS

Hi:

For the 'TOTAL' thing, I can't even begin to guess what's going on, since you did not share your code (or any code). Possibly the variable in your first column is numeric or possibly the first variable is character, but has a length of 1...when you use the COMPUTE block technique, you are limited to the number of characters that represent the length of the item in the first column.

So, if for some reason, you can't post your code and data, try to replicate your PROC REPORT using SASHELP.CLASS or SASHELP.SHOES. If the 'TOTAL' thing works with SASHELP.CLASS or SASHELP.SHOES, then you have to consider the differences between the SASHELP data and your data. IF the 'TOTAL' thing doesn't work with SASHELP datasets, then perhaps you have discovered something strange going on. But, again, seeing your code (your actual code and ALL your code, including ODS statements) will be most helpful.

Have you read the PROC REPORT documentation? Or looked for user group papers about PROC REPORT and/or COMPUTE blocks? If you are new to PROC REPORT and COMPUTE blocks, perhaps some research would help focus your question or reveal where your COMPUTE block might be failing.

cynthia

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
• 5 replies
• 484 views
• 0 likes
• 2 in conversation