BookmarkSubscribeRSS Feed
metallon
Pyrite | Level 9


Hi SAS Experts,
I have pre-calculated sums in my source data table:

Example:

Group--Substance--Positives
A______Ivy________34
A______Box________3
Asum______________17
B______Ivy________11
B______Box________25
Bsum______________40

The custom sums are not logical "sums" top-down
but present a "different" way of summing up.
So I cant use a GROUP and BREAK in my PROC REPORT
but must display those custom sums as if they
indeed where just caused by GROUP and BREAK.

There is the problem of order, how does SAS now
that Asum should come after all the A's and second
how to display my pre-calculated number as a "sum" i.e. GROUP / BREAK.

Can someone point me in the right direction?

@RW9, this is a requirement by the end-user.
I have not chosen to create those weird totals/sums
that do not really represent totals.

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Just do it in the datastep.  If you want subgroups:

data inter;

  set want;

  if group="Asum" then do;

    line="----------------"; output;

    line=strip(group)||" - "||strip(put(positives,best.));

    line="--------....

run;

 

So set your dataset up eaxctly as you want the output to look, don't try to do illogical things through logical processes.  Alternatively, add another variable to group things?

Reeza
Super User
Create a variable that maps to your grouping and use that.
ballardw
Super User

If your group and substance values are separate variables you should be okay just calling them grouping variables though you may needt to specify that missing values of substance are okay. And if the values are are precalculated then look at using a listing style report, no summary statistics (sum ) needed.

 

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