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

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @Jaheuk 

 

Totally agree with @Kurt_Bremser984.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;

 Capture d’écran 2020-01-02 à 12.42.44.png

 

View solution in original post

4 REPLIES 4
ed_sas_member
Meteorite | Level 14

Hi @Jaheuk 

 

Could you please provide some sample data as well as the desired output?

 Thank you!

Jaheuk
Obsidian | Level 7

Capture.PNG

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 Smiley Sad

 

 

 

 

 

ed_sas_member
Meteorite | Level 14

Hi @Jaheuk 

 

Totally agree with @Kurt_Bremser984.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;

 Capture d’écran 2020-01-02 à 12.42.44.png

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 531 views
  • 0 likes
  • 3 in conversation