This question largely arises from a scene in the TV Show Frasier, but it got me wondering, can a Doctor write a prescription for an individual that he knows they need, but has not gone through the diagnostic steps himself (or via an associated lab)? For further context the story from the show is below.
In the particular episode, Niles, a licensed and practicing psychiatrist and Daphne are at Niles' apartment. Niles is interested in getting physical with Daphne and it appears he might have a chance, however an alarm goes off for her to take her unnamed prescription for a thyroid issue. They go back to Daphne's apartment to get the medication and sitcom shenanigans occur such that Niles will not be playing doctor with Daphne -- the root cause of this is identified as Daphne having to go back to get her medication.
Frasier (another licensed psychiatrist) asks niles why he didn't just write a prescription for the medication himself; the question obviously frustrates niles as if this had been a valid option.
Stripping out all the sitcom shenanigans and reasoning, could a doctor, if he knew a patient needed medication (In the example above, Niles has no reason to believe Daphne is angling to get illicit medications or fool him, but that may play a part in the answer) but had not gone through the diagnostic procedures himself and had no access to reviews those records, legally and ethically write said prescription?