The sale of prescription data, though with the patients' identities been removed, has become a lucrative industry in the US. The information is purchased from pharmacy chains and the companies that manage drug benefits for employers.
By purchasing the data describing which doctors prescribe what drugs, pharmaceutical sales forces are better able to identify which doctors might use their products and be receptive to their sales pitches. They can also focus on persuading doctors who do not write many prescriptions for their products to change their minds.
Two large data-mining companies, IMS Health and Verispan had sued in 2006 to block implementation of the New Hampshire law that came in the way of their business.
The law was intended to cut down on state health care costs by eliminating the tool used by drug sales representatives in promoting brand name drugs.
Saying in Tuesday's opinion that the enterprise of buying and reselling prescription information was "mind-boggling" in its scope, United States Court of Appeals Judge Bruce Marshall Selya wrote, "The record contains substantial evidence that, in several instances, detailers armed with prescribing histories encourage the overzealous prescription of more costly brand-name drugs regardless of both the public health consequences and the probable outcome of a sensible cost/benefit analysis."
The three-judge panel concluded that "the state adequately demonstrated that the Prescription Information Law is reasonably calculated to advance its substantial interest in reducing overall health care costs within New Hampshire."
The appeals court ruling on Tuesday overturned a decision last year by United States District Judge Paul Barbadoro of Concord, N.H., that stuck down the New Hampshire law on First Amendment grounds.
(The famous amendment to the US constitution, guaranteeing various freedoms to the citizens, has also been effectively utilized by businesses to protect their respective domains.)
Tuesday's decision could also have implications in other states that have either adopted or are considering similar legislation, particularly Maine, which is in the same appellate district as New Hampshire and where a similar law was also struck down by a district court this year. Vermont has also enacted a similar law that is to take effect next year but is also facing a court challenge.
Such legislation has been urged by doctors who object to the disclosure of their prescribing patterns.
The American College of Physicians asked the larger American Medical Association to prohibit the release or sale of doctors' prescribing information. In 2006, the A.M.A. established a registry of doctors who could "opt out" of having their prescription data shared with sales representatives. That was part of a voluntary arrangement the A.M.A. reached with the data companies.
In sponsoring the New Hampshire legislation in 2006, Representative Cindy Rosenwald of Nashua, said she was motivated partly by high state Medicaid drug costs, which she said had been driven up by pharmaceutical marketing.
Besides her state, Maine and Vermont, Ms. Rosenwald predicted Tuesday that other states would now take a more serious look at enacting such laws.
"A lot of states have been looking at this and have come very close to enacting it," she said, "and then they've basically said while this is still on appeal, we should just wait."