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?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.