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
... View more