dear all,
using <colpctsum> I get the percentage of a column with amounts.
great but HOW do I get tha value itself ( amount * colpctsum ) ??
H.
Hi @Jaheuk
Totally agree with @Kurt_Bremser, 984.555 IS already 55,8% of 1.764.661.
But if you think that makes sense in your context, you can try this to get your report:
data have;
input amount;
datalines;
984555
109331
2933
378
620125
46038
1011
291
;
run;
proc sql;
create table want as
select a.amount,
a.amount / b.total as percent format=percent8.1,
a.amount * calculated percent as value
from have as a, (select sum(amount) as total from have) as b;
quit;
proc print data=want noobs;
sum amount percent value;
run;
55,8 % of amount 984.555 = 549.283 euro, so an extra column with this value
I googled a lot, but I think it is not possible to add a calculated column
984.555 IS already 55,8% of 1.764.661, so applying the percentage again makes no sense.
Hi @Jaheuk
Totally agree with @Kurt_Bremser, 984.555 IS already 55,8% of 1.764.661.
But if you think that makes sense in your context, you can try this to get your report:
data have;
input amount;
datalines;
984555
109331
2933
378
620125
46038
1011
291
;
run;
proc sql;
create table want as
select a.amount,
a.amount / b.total as percent format=percent8.1,
a.amount * calculated percent as value
from have as a, (select sum(amount) as total from have) as b;
quit;
proc print data=want noobs;
sum amount percent value;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.