Let \(I\subset \mathbb {R}\) be an interval. A function \(M:I^{2}\rightarrow I\) is said to be weakly associative, if \(\begin{aligned} M\left( M\left( x,y\right) ,x\right) =M\left( x,M\left( y,x\right) \right) , \qquad x,y\in I. \end{aligned}\) One can easily check that every weighted quasi-arithmetic mean, i.e. a function \(M:I^{2}\rightarrow I\) given by \( M\left( x,y\right) =f^{-1}\left( pf\left( x\right) +\left( 1-p\right) f\left( y\right) \right) , \) where \(f:I\rightarrow \mathbb {R}\) is a continuous and strictly monotonic function and \(p\in \left[ 0,1\right] \) , satisfies the above condition, so it is weakly associative. We give the characterization of weakly associative functions in the class of some generalized weighted quasi-arithmetic means. Moreover, we characterize premeans which are rational functions of degree at most 2 and weakly associative.