I have two tables A and B. Table A has Id, Item_Name, price_start_date, new_price_end_date Table B has Covers, Date. I want to create a code to add all the covers in Table A which lie in between Price_start_date and new_price_end_date (that is sum of covers between the dates in Table B). I wrote a code to Proc SQL; create table work.covers_before_total as Select a.*, Sum(Case When a.Price_start_Date <= a.NEW_Price_End_Date and a.Price_start_Date <= b.date and a.NEW_Price_End_Date >= b.date then b.Covers Else 0 END) as covers from work.covers_before a,work.covers_measurement_model b group by a.id Run; But the sum gives out 0 for some reason. Is there also a better way of doing it?
... View more