Knock out from a distance

Per the below rules, it looks like that a PC can only knock out a creature when in melee.

Sometimes an attacker wants to incapacitate a foe, rather than deal a killing blow. When an attacker reduces a creature to 0 hit points with a melee attack, the attacker can knock the creature out. The attacker can make this choice the instant the damage is dealt. The creature falls unconscious and is stable.

Is there something I am missing in order to be able to knock a creature from a distance (by a range weapon or a spell for instance). Or this is not doable ? If at the GM discretion : do you usually allow it ? With any specificity ?