In a PROC REPORT I figured out how to insert a sub-title row before a new group begins, but I cannot figure out out to get the correct group name into the sub-title. Notice that in my output : 1st sub-title text is 'Make:' 2nd sub-title is 'Make: Chevy' It is supposed to be 1st sub-title should be 'Make: Chevy' 2nd sub-title should be 'Make: Ford' My code is below, screen shot of output is attached. Here is the code to create data for this example: data cars;
infile datalines dlm=',';
input makeNum make:$12. _BREAK_:$25. description:$50. retail myCost;
datalines;
1,Chevy, , Chevy-Impala-Red, 32000, 29000
1,Chevy, , Chevy-Impala-Blue,32000, 29500
1,Chevy,makeModel, Total: Chevy-Impala, 64000, 58500
1,Chevy, , Chevy-Malibu-White, 28000, 26500
1,Chevy,makeModel, Total: Chevy-Malibu, 28000, 26500
1,Chevy,make, Total: Chevy,92000, 85000
2,Ford, ,Ford-Fiesta-Silver,14000,12000
2,Ford, ,Ford-Fiesta-Blue,14000,12000
2,Ford,, ,Ford-Fiesta-Gold,14500,12000
2,Ford,makeModel, Total: FordFiesta, 42500,36000
2,Ford, ,Ford-Focus-Silver, 17000, 16000
2,Ford, ,Ford-Focus-Blue,1700,15800
2,Ford,makeModel, Total: Ford-Focus,34000,31800
2,Ford,make, Total: Ford, 76500,67800
, , _RBREAK_, TOTAL: ,168500,152800
;
run; Here is my code for the report: TITLE1 "List Report";
FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
proc report data=WORK.CARS nowd;
column makeNum make _BREAK_ description retail myCost;
define makeNum / group missing order=data noprint;
define make /group missing order=data noprint;
compute make;
if make ne ' ' then hold1=make;
if make eq ' ' then make=hold1;
endcomp;
define _BREAK_ / display '_BREAK_' missing order=data noprint;
define description / display 'description' missing order=data;
define retail / display missing order=data;
define myCost / display missing order=data;
compute _BREAK_;
if _BREAK_ ne ' ' then do;
call define(_ROW_,'style','style=[font_weight=bold foreground=Black paddingbottom=10]');
end;
endcomp;
COMPUTE Before makeNum;
LENGTH text $ 50;
IF makeNum > 0 THEN DO;
text = cat('Make: ', make);
num=50;
END;
ELSE DO;
text = "";
num=0;
END;
LINE text $VARYING. num ;
ENDCOMP;
run;
quit;
TITLE;
FOOTNOTE;
... View more