data sample;
input state$ city$ product$ selling_price revenue;
datalines;
Maharashtra Mumbai Soap 100 10
Maharashtra Mumbai Shampoo 200 20
Maharashtra Pune Soap 100 10
Maharashtra Pune Shampoo 200 20
Gujrat Baroda Come 100 2
Gujrat Baroda Pin 300 40
Gujrat Surat Come 100 2
Gujrat Surat Pin 400 10
Punjab Amritsar Pencil 200 3
Punjab Chandigarh Rubber 20 3
;
run;
proc print data=sample;
run;
proc report data=sample;
column state city product showall showcity selling_price revenue;
define state/group;
define city/group;
define product/group;
define selling_price/analysis;
define revenue/analysis;
compute before state;
length Indian_state $25;
Indian_state = state;
endcomp;
compute before city;
length indian_City $25;
Indian_city = city;
endcomp;
;
compute showall / character length=25;
showall = Indian_state;
endcomp;
compute showcity / character length=25;
showcity = Indian_city;
endcomp;
break after state / summarize style=Header{background=lightyellow};
break after city / summarize ;
rbreak after / summarize style=Header{background=lightgreen};
compute after state;
showall = catx(' ','Total',Indian_state);
showcity = 'All city';
** how to simulate a SKIP in ODS output;
line ' ';
endcomp;
compute after city;
showcity = 'SubTotal';
endcomp;
compute after;
showall = 'Grand Total';
showcity = 'All Regions';
endcomp;
run;