I believe the sanctity of life should be valued over the quality of life. People can enjoy life regardless of their quality of life in many cases, unless their situation is so dire that it limits their abilities to enjoy life on a daily basis. For this reason I believe the sanctity of life is more important.
Yes, the sanctity of life should be valued over the quality of life, because the person should be allowed to decide whether they want to live. A person who is old should have their own choice whether to continue with feeding tubes or a breathing machine, not have that decision made by someone else.
If the quality of life is somehow deemed more important than the overall sanctity of life, we wind up in situations where lives might be ended or allowed to end because they are somehow judged as inferior or not up to par. Even if done with the best of intentions in individual cases, it leads to an overall pattern of potential discrimination.
If we value sanctity of life over the quality of life, we take away a person's autonomy (self-determination). We live in a society in which choice is a very high value, and valuing sanctity of life over the quality of life is very hypocritical. If someone has, let's say, Motor Neuron Disease, it's not our decision whether they have a quality of life or not. Quality of life is very subjective, and therefore can only be decided by the person in question. Stephen Hawking had a good quality of life, as seen by his scientific advances and his will to carry on. However, others may not see that point of view and therefore we cannot impede on their choice. It is wrong for us to prolong a suffering existence if the person in question does not wish to live it.
Let us suppose that there is a patient dying of cancer, and the disease produces a great deal of pain, but they can be kept alive by artificial means, This patient with terminal cancer, with no hope, is experiencing this pain for no reason. It serves nothing at all. Why should we elevate sanctity of life over quality of life when that road leads to more suffering.