11-11-2013 06:03 PM
I am new to SAS and my question might seem stupid to SAS experts. All I need is to write a program that does the following: I have a huge data set (several millions values) of people who payed for something. The same name may appear multiple times in the list with different amounts payed. The program should count how much each person spent in total and to output the name of the person who spent the highest amount.
thanks for your help!
11-11-2013 08:05 PM
You could use proc sql. e.g.:
input id spent;
select distinct id,total_spent
from (select *,sum(spent) as total_spent
group by id)
having total_spent eq max(total_spent)
11-11-2013 08:27 PM
What does your data look like?
You can check proc freq with the weights option or proc summary to summarize your data.
proc freq data=have order=freq no print;
proc means data=have noprint;
output out=summary2 sum(amount_payed)=total_payed;
proc sort data=summary2;
by descending total_payed;