ANY given episode of a television medical drama is likely to feature a patient going into cardiac arrest. As the victim thrashes around, a telegenic doctor summons a posse of helpers, who start zapping the patient, compressing his chest or administering adrenalin jabs until the heart starts ticking again.

On TV these efforts almost always succeed, spectacularly and immediately. The real world, sadly, is crueller: doctors manage to restart only about half of the hearts that stop in a hospital, and only about a sixth of patients will go on to survive long enough to be discharged. One of the toughest decisions faced by hospital staff is how long to keep trying, and when to give up on a particular patient as a lost cause.

A new paper, published in the Lancet, aims to provide some scientific backing for such decisions. A team of researchers led by Brahmajee Nallamothu at the University of Michigan looked at data from more than 64,000 patients who had suffered cardiac arrests in 435 American hospitals between 2000 and 2008. There are no official guidelines specifying how long doctors should keep trying to resuscitate flatlining hospital patients. As a result, the authors wondered whether the amount of time spent attempting resuscitation might vary from hospital to hospital. Sure enough, it did. The median resuscitation attempts in patients who eventually died lasted 16 minutes for the bottom quarter of hospitals; for the top quarter it was 25 minutes.

That matters, for the researchers also found that a greater willingness to persist correlated with better survival chances for patients. Circulation was restored in 45.3% of patients in the bottom quarter of hospitals; 14.5% survived long enough to be discharged. For the top quarter, the figures were 50.7% and 16.2% respectively, a boost of 12% in both cases.

One reason why doctors are reluctant to spend too long attempting to revive patients is that they worry about brain damage caused by prolonged lack of oxygen. But the study found that, after adjusting for factors such as age and general health, patients from hospitals more willing to try long resuscitations showed no greater risk of brain damage.

Such a big discrepancy in a fairly common procedure may look odd—if all hospitals performed as well as the best, thousands of lives a year might be saved. But plenty of medicine has only a thin base in scientifically reviewed evidence, meaning that the opinions, judgments and prejudices of individual doctors often determine how treatment is given.

A difficulty is that medical decisions are complicated. A doctor considering whether to continue with chest compressions, for instance, must weigh any number of factors, from the patient’s age to other conditions he may be suffering from or the effects of drugs used to treat them. The presence of so many confounding factors makes it hard to assess the general effectiveness of any given treatment—unless, like Dr Nallamothu and his colleagues, you have access to a great deal of data.

As with any piece of scientific research, there are caveats. Dr Nallamothu points out that the study could simply be picking up an effect of better hospitals, with a willingness to persist with resuscitation a consequence of better technology or better-trained doctors, neither of which can be detected by the study. And the tricky clinical particulars of any given resuscitation mean that the paper cannot give rise to hard-and-fast rules about exactly how long doctors should persist. But it does suggest that plenty of lives might be saved if medics are willing to keep trying for a little bit longer.