Can I define variables to be used in number buttons across the interface? In previous versions of blender, it was possible to use mathematical expressions containing "#frame" within - if I remember correctly - any number button. Every value controlled by #frame would then be updated frame by frame with the result of the formula.

By generalizing this concept, I wonder if it's possible to define (keyframe-able) variables in one place and then use them as inputs across the entire interface. For example, it would be handy to be able to define a "#clay" variable that simultaneously controls the factor of several Mix Shader nodes, but also determines the intensity of a couple of light sources, and possibly do other things such as reducing render samples and so on. This way, I could switch from realistic to clay render (or an in-between version) by adjusting that slider from 0 to 1.

Is it possible to do this without writing a script?
This is what drivers are for. You can use them to take some mathematical expression (or a bit of Python code) to determine the value of settings.

For more information on this topic, see the Drivers section of the Blender manual.