If the AS number is changed at the router level (config>router) the new AS number is not used until the BGP instance is restarted either by administratively disabling and enabling the BGP instance or by rebooting the system with the new configuration.
On the other hand, if the AS number is changed in the BGP configuration (config>router>bgp), the effects are as follows.
A change of the local-AS at the global level causes the BGP instance to restart with the new local AS number.
A change of the local-AS at the group level causes BGP to re-establish sessions with all peers in the group using the new local AS number.
A change of the local-AS at the neighbor level causes BGP to re-establish the session with the new local AS number.