The 1st U.S. Circuit Court of Appeals in Boston ruled this week on Maine’s law after previously upholding a similar New Hampshire law making doctors’ prescription-writing habits confidential. The U.S. Supreme Court let New Hampshire’s law stand last summer.

Three companies that collect, analyze and sell medical data for use in pharmaceutical companies’ marketing programs challenged the law.

“The plaintiffs suggested that this law chills their commercial free speech. All our law does is protect the privacy of doctors who prescribe medications,” said Maine Attorney General Janet Mills.

Story continues below advertisement.

The Maine law was aimed at reducing health care costs by taking away the data drug companies use for hard-sell tactics on doctors. It allows doctors to choose to withhold their individual prescription-writing information from the data-mining companies, which otherwise would have access to it.

So far, 265 doctors have chosen to prevent the release their information, but the law has been on hold because of the legal challenge.

The prescription data are considered invaluable by drug company salespeople, who use it to identify doctors’ drug preferences, whether they favor brand-name medicines over generics, and whether doctors are willing to prescribe new drugs over older medications.