with Proc SQL is possible to have the SUM of distinct values of a specific variable. I need an option in this Proc that sum values of a variable referring to different values of another variable. Another way could be the proc sort nodupkey and then the proc freq.
each row that i drop has the same values of the row that I keep. Let me show you a situation similar to my database:
variable ID identify a person
variable X specify a weight
In the database there are a lot of duplicated record, It's not important wich rows i've deleted. I need to calculate the sum of x but i can't use X as distinct values option because identical values of X are linked to different ID.
Maybe a subquery would help :
[pre]PROC SQL ;
SELECT SUM(x) FROM (
SELECT DISTINCT id, x FROM myData
This is very similar to executing a PROC SORT with the NODUPRECS option prior to summing.
Hope this helps.
Message was edited by: Olivier