Profit is computed as a percentage of Sales. For nonperishable items, the profit is 40% of the sale price. For perishable items the profit is 25%. Notice that in the compute block you must reference the variable Sales with a compound name (Sales.sum) that identifies both the variable and the statistic that you calculate with it.
   compute profit;
      if department='np1' or department='np2' 
         then profit=0.4*sales.sum;
      else profit=0.25*sales.sum;
   endcomp;