Connections between local and macroscopic properties in solids: The case of N in III-V-N alloys