I attached the dataset that I'm worcking with, so that it is easier to understand my problem. The smallest level of aggregation of the dataset is the set "ID + #_citation + Date" (that is, a specific person that cites a certain product in a specific date). I need to find a way to multiply the continuous variable "weight" and the dicotomic variable "Web" and sum the resulting number only for distinct IDs (note that the weigth associated to an ID changes for differents Dates, so the "distinct" function must take the unique sets of "ID+Date"). After that I will need to create a variable that gives me the percentage over the total number of (distinct and weighted) people that are in the dataset. My main problem is the fact that I have to use the weights to sum over the "Web" variable. Is there a way to do this?