state_setval function

Set a state value to be kept for next the transformation function is called.