10-08-2015 04:50 PM
Here is the table I have.. I have tried to simplify the questions so you understand what i am doing. Trying to create a data step that sums up all the products of apple.. if apple is not in the list for paul then return the banana amount.
10-08-2015 06:39 PM
Here's one approach ... note that these are tools you will need to master in the long run.
proc summary data=have nway;
class customer product;
where product in ('apple', 'banana');
output out=totals (keep=customer product amount) sum=;
Note that the data set TOTALS will automatically be in order BY CUSTOMER PRODUCT. So if "banana" is there, it will be the last one for a CUSTOMER. If not, "apple" will be the last one.