Why association pattern unmatched when using variable

I have association and want to replace integer in specific element in this association. I’m trying to build pattern to be used by ReplaceAll command. When number is explicitly provided in pattern match occurs, but when I put number in a variable and provide number from variable match fails.

In[1]:= MatchQ[<|id -> 6, dur -> 10, skill -> 1, succ -> {7},    dl -> 250|>, <|la___, succ -> {l___, 7, r___}, ra___|>]  Out[1]= True  In[2]:= last = 7 last[[0]]  Out[2]= 7  Out[3]= Integer  In[4]:= MatchQ[<|id -> 6, dur -> 10, skill -> 1, succ -> {7},    dl -> 250|>, <|la___, succ -> {l___, last, r___}, ra___|>]  Out[4]= False 

As shown in this example first match occurs, but second fails with number in variable.