There's a formula that determines what the stat is, which uses variables such as IVs, EVs, Nature, base stat and level.

(btw that last word is nature lol. Nature = 0.9 if it hinders the stat; Nature = 1.1 if it benefits the stat.)

So a Rare Candy would still raise a Pokemon's stats by some amount. However, the EVs gained from battles while on that level grow the stat higher upon level increase.

Those are the only two variables in the formula that really change at any point; the other variables are determined at the moment of generation and remain constant forever unless it is hacked or something.

Hope I helped. :)

Source: Individual Values article from Bulbapedia + Experience