In the second print fails because beta_soc_dem_edu_spend has no value and therefore no shape yet. It only obtains a value once you start sampling from the distribution.
In the first print you refer to beta_soc_dem_edu_spend.shape which is a symbolic theano expression that can be used, e.g., to define a computation that only produces a value once its .eval() is called. Here is an example:
with pm.Model() as model:
beta = pm.Normal('β', shape=1)
a = pm.Normal('a', mu=beta.shape, testval=0)
trace = pm.sample()
Looking at np.mean(trace['a']) shows 0.9695488955681962 so the mean of pm.Normal('a', ... is indeed the shape of beta.
If you want to use the shape of beta during the model definition you could store it in a separate variable, e.g.:
beta_shape = 1
with pm.Model() as model:
beta_soc_dem_edu_spend = pm.Normal('β(soc_dem, edu spend)', shape=beta_shape)
print('β(soc_dem, edu spend) shape is: %s'%beta_shape)