A federal appeals court has upheld the constitutionality of a Maine law restricting medical data companies’ access to doctors’ prescription information.

The 1st U.S. Circuit Court of Appeals in Boston ruled this week on Maine’s law. 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.

Tom Julin, who represented the companies, said they won’t decide whether to appeal until after the 2nd U.S. Circuit Court of Appeals rules on a similar law in Vermont. That decision is expected in a matter of days, he said.

The Maine law was aimed at reducing health care costs by taking away the data that drug companies use for hard-sell tactics on doctors. It allows doctors 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 of their information, but the law has been on hold because of the legal challenge.

The prescription data is considered invaluable by drug company sales people, 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.

The companies that sued were IMS Health of Norwalk, Conn.; Verispan LLC, which was later acquired by Pennsylvania-based SDI; and Source Healthcare Analytic Inc., a subsidiary of Philadelphia-based Wolters Kluwer Health Inc.

They don’t apologize for making a profit, and stress that the information they gather also is used by researchers, law enforcement and government agencies.

“Everyone wants access to more information, not less,” the firms said in a statement.