Paige,
As your wish , but that is not easy, you need change the code according to the data.
data have; input ID Code Date :anydtdte. Amount; format date ddmmyy10.; datalines; 1 0 31.01.2020 100 1 1 29.02.2020 80 1 2 31.03.2020 120 1 1 30.04.2020 75 2 2 31.01.2020 200 2 2 29.02.2020 150 2 4 31.03.2020 125 2 0 30.04.2020 230 3 1 31.01.2020 75 3 1 29.02.2020 65 3 3 31.03.2020 80 3 4 30.04.2020 90 4 0 31.01.2020 500 4 0 29.02.2020 350 4 1 31.03.2020 200 4 1 30.04.2020 100 ; options missing='0'; proc report data=have nowd out=w; columns date code,amount total; define date/group; define code/across; define amount/analysis sum; define total/computed 'Total'; compute total; total=sum(_c2_,_c3_,_c4_,_c5_,_c6_); endcomp; run;
Thanks @Ksharp , but the documentation clearly indicates you can put a statistic keyword in the COLUMNS statement. So the explicit calculation via a compute block shouldn't be necessary.
Nevertheless, the code I posted a few minutes ago works only for SUM, I still can't get it to work for MEAN.
@PaigeMiller wrote:
Nevertheless, the code I posted a few minutes ago works only for SUM, I still can't get it to work for MEAN.
Now it works with MEAN (and analogously for any other statistic SUM, P75, etc.)
proc report data=sashelp.class;
columns sex ("Age" age,height ("Average" height=heightmean));
define sex/group;
define age/across ' ';
define height/analysis mean;
define heightmean/analysis mean format=6.1;
run;
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!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.