BookmarkSubscribeRSS Feed
smilbuta
Fluorite | Level 6
Hello community,

I am using EG4.1 , I am producing a report for output in HTML.

My question centers around how to use the summarize command but not summarize ALL Columns.


My data example is as follows (periods simply for spacing in post)

Name... value1..value2..Difference
----------------------------------------------------
Name1.....10.....20.....-50%
Name2.....15.....10..... 33%
Name3.....10.....0.....100%
---------------------------------------------------
Totals.....35.....30..... XXXXXX <-----------problem.

When using the summarize option on a break statement it summarizes all columns , even the percentages. I wish to evaluate the percentage based on the totals of value1 and value2 not the values of the difference.

Is there a way to do this?
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
"ODS Reporting" doesn't necessarily mean PROC REPORT -- you could be using PROC TABULATE or PROC PRINT or even PROC SQL (or even the DATA step). So, can you also explain what your reporting PROCEDURE of choice is (REPORT, PRINT, TABULATE, SQL)?

Can you also explain a bit about how the DIFFERENCE column is being derived and percentage is being calculated (the specific formula)
DIFFERENCE = (VALUE1 - VALUE2) / ??divided by???

Also, are you calculating DIFFERENCE in a query within EG or are you using a DATA step program or reporting procedure to calculate DIFFERENCE ???

Generally, with EG, there is a way to "preview" the code that is being submitted to SAS for processing. Can you show that code here???

If you are using PROC PRINT or PROC TABULATE, then there would be no way to alter the totals calculated on the break line. If you are using PROC REPORT, then you could probably either suppress the total for DIFFERENCE or recalculate (using your own formula) the number for DIFFERENCE in a COMPUTE block.

Also, in order to maintain spacing and indenting in code and output that you show, you can use the techniques described in this previous forum posting, such as the use of the [pre]and [/pre] tags around your code and output in order to maintain indenting and spacing.:
http://support.sas.com/forums/thread.jspa?messageID=27609毙

as I did to show your desired output below (without dots)
[pre]

Name value1 value2 Difference
----------------------------------------------------
Name1 10 20 -50%
Name2 15 10 33%
Name3 10 0 100%
---------------------------------------------------
Totals 35 30 XXXXXX <-----------problem
[/pre]

cynthia
Ksharp
Super User
Hi.
I am not familiar with EG.
If you use proc report code.
and assuming your grouping variable is name ,then can do such as:
[pre]
.........
compute difference;
if _break_ eq 'NAME' then difference=' ';
.................
[/pre]


Just a recommendation.
And I think Cynthia can do better than me.

Ksharp

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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