Surface effects on valence in rare-earth intermetallic compounds