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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

 I already had an example using SASHELP.PRDSALE -- using slightly simplified logic, as shown below:

custom_breaks.png

 

Hope this helps,

Cynthia

View solution in original post

3 REPLIES 3
sameer112217
Quartz | Level 8

I want something like this in the picture... subtotal of city and then total of that city and finally total of all. my previous code did not workpaint.png

Cynthia_sas
SAS Super FREQ

Hi:

 I already had an example using SASHELP.PRDSALE -- using slightly simplified logic, as shown below:

custom_breaks.png

 

Hope this helps,

Cynthia

sameer112217
Quartz | Level 8

thanks cynthia this is exactly what i wanted.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 870 views
  • 0 likes
  • 2 in conversation