BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NathanOch
Obsidian | Level 7

I am trying to move a value from a numeric field column in the RBREAK summary line to a character field column in the RBREAK summary line.

 

I have a list of account numbers in a character field and I want to show the total number of accounts in the RBREAK summary line under list in the same character column as the account numbers. Here is an example where the number in bold is the total:

...

29487758

20447647

29223674

26185954

14,298

 

I have tried creating a dumby field that displays the integer 1 for each account and then aggregates for the total in the RBREAK line. How would I get that total into character format and moved to the RBREAK line under my list of accounts?

 

Here is some example code from the CLASS dataset in SAS with my attempt in red.

 

TITLE1 "List Report";

FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";

proc format;

value blankValue other=' ';

run;

proc report data=WORK.QUERY_FOR_CLASS nowd out=exdata;

column Name Sex Age Height Weight N;

define Name / group 'Name' missing;

compute Name / char length=12;

if _break_ = '_RBREAK_' then Name = put(N.sum,4.);

/*if _break_='_RBREAK_' then do;

call define("N.SUM", 'format', '$6.');

end;*/

endcomp;

define Sex / group 'Sex' missing;

compute Sex;

if _break_ eq ' ' then do;

if Sex ne ' ' then hold2=Sex;

end;

endcomp;

define Age / analysis SUM 'Age' missing;

compute Age;

if _break_='_RBREAK_' then do;

call define("Age.SUM", 'format', 'blankValue.');

end;

endcomp;

define Height / analysis SUM 'Height' missing;

compute Height;

if _break_='_RBREAK_' then do;

call define("Height.SUM", 'format', 'blankValue.');

end;

endcomp;

define Weight / analysis SUM 'Weight' missing;

compute Weight;

if _break_='_RBREAK_' then do;

call define("Weight.SUM", 'format', 'blankValue.');

end;

endcomp;

define N / analysis SUM 'N' missing;

/*rbreak after / summarize;*/

compute after;

/*strg = "Total Accounts = " || trim(left(put(N.sum,5.2)));*/

count(Name);

line ' ';

endcomp;

run;

quit;

proc catalog catalog=work.formats;

delete blankvalue / entrytype=format;

run;TITLE; FOOTNOTE;

 

Thanks!

Nate

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

proc report data=sashelp.class nowd;
column sex name weight n;
define sex/order;
define n/noprint;
compute after;
 weight.sum=.;
 name=put(n,best8.);
endcomp;
rbreak after /summarize;
run;

View solution in original post

2 REPLIES 2
Ksharp
Super User

proc report data=sashelp.class nowd;
column sex name weight n;
define sex/order;
define n/noprint;
compute after;
 weight.sum=.;
 name=put(n,best8.);
endcomp;
rbreak after /summarize;
run;

NathanOch
Obsidian | Level 7

Ksharp,

 

Thank you for the help, I could not quite get the code right to work.

 

Regards,

Nate

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1104 views
  • 0 likes
  • 2 in conversation