An automated medication dispensing system requires a practitioner to input the required dosage of a drug in milligrams and the patient's unique alphanumeric reference code.
Explain why the system must validate this input data.