array must be of constant range error

i have an output reg called compressed_out.base_size and delta_size are parameters. if the enable[l] = 0, I need the base_size bits in sub_out to be written to compressed_out. if enable[l]=1, only delta_size number of bits from sub_out is to be taken to compressed_out. how can we give correct ranges in the body of if else statement to select bits of compressed_out. my code is not correct, please help me to solve the issue.

wire [base_size - 1:0 ]sub_out[n-2:0];
.
.
for(l=0;l<n-1;l=l+1)
begin
if(enable[l]==0)
compressed_output[(base_size *(l+2)-1)-:base_size] = sub_out[l];

else
compressed_output[(base_size - delta_size)*(l+2)-1 -:(base_size - delta_size) ] = sub_out[l][delta_size -1 :0];
end


What the error says: the size/width of the register, which comes from the expression after the -:, must be a constant.
If you tell a bit more about what you want to do and the limits we might come up with a solution. Often shift operations << >> can get you a long way.