Hello
I wan to add Total row under each score and also grand total row.
So there will be extra 3 total rows (one for score 'a' , second for score 'b' and 3rd for grand total
What is the way to do it please using proc tabulate?
Data rawtbl;
informat ddate date9.;
format ddate date9.;
input ID ddate score $ Y;
cards;
1 '10NOV2019'd a 100
2 '10NOV2019'd a 200
3 '10NOV2019'd a 250
4 '10NOV2019'd b 300
5 '10NOV2019'd b 50
6 '11NOV2019'd b 150
7 '11NOV2019'd b 100
8 '11NOV2019'd a 200
9 '11NOV2019'd a 250
10 '12NOV2019'd a 300
11 '12NOV2019'd a 50
12 '12NOV2019'd b 150
;
run;
title;
proc tabulate data=rawtbl f=6. out=want;
class score ddate;
var Y;
tables score*ddate, Y*(sum PCTN);
run;
Great!! I got solution
title;
proc tabulate data=rawtbl f=6. out=want;
class score ddate;
var Y;
tables score *(ddate All='total') ALL, Y*(sum PCTN);
run;
When I add ALL then I get global total.
It is good but I need also to get total after each score...
title;
proc tabulate data=rawtbl f=6. out=want;
class score ddate;
var Y;
tables score *ddate ALL, Y*(sum PCTN);
run;
Great!! I got solution
title;
proc tabulate data=rawtbl f=6. out=want;
class score ddate;
var Y;
tables score *(ddate All='total') ALL, Y*(sum PCTN);
run;
It is a bit confusing because I add total for each score and not for each date......but in the code I need to add ALL keyword near date and not not near score
Sorry, i don't get it. Can you show want you want?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.