Thirteen companies based in Massachusetts are among the 150 best places to work in the country, according to a survey out Thursday.

Among the top-ranked in Massachusetts, the Cambridge pharmaceutical company Millennium: The Takeda Oncology Co., finished 12th, followed by Suffolk Construction Co. in Boston (24th), athenahealth Inc. in Watertown (45th), and New Balance Athletic Shoe Inc. in Brighton (61st).

The rankings were compiled by the employee survey company WorkplaceDynamics of Exton, Pa.

Advertisement

The survey, of more than 1 million workers at 872 companies, was compiled from data gathered last year for 30 newspapers, including The Boston Globe, which uses the information about Massachusetts companies in its annual Top Places to Work
publication. WorkplaceDynamics ranks each organization based on employee responses to 22 questions about a company’s direction, pay and benefits, and management, as well as an employee’s engagement with the company and satisfaction with work.

Get Talking Points in your inbox:

An afternoon recap of the day’s most important business news, delivered weekdays.

For the nationwide rankings, which were started last year, WorkplaceDynamics considered only companies with 1,000 or more employees that had at least 350 people fill out the survey. This eliminated many companies with smaller workforces and response rates that had made the Globe’s Top Places to Work magazine.

Crucial factors taken into consideration are the organization’s leadership, direction, and connection to its employees, said Doug Claffey, chief executive of WorkplaceDynamics.

Four oil and gas companies made the top 10, reflecting how hard the industry is working to attract talent in a growing field, Claffey said.

Advertisement

On the flip side, only two technology companies cracked the top 50, the result of too many workers and not enough jobs, he said,as well as a notorious lack of work-life balance in the field.

Knowing what people think of their jobs is key to bettering working conditions, and, in turn, the economy, Claffey said. “If we can improve the quality of the workplace across our whole country, then we as an American workforce can be more competitive in the global economy.”

The key to happiness is making employees feel appreciated at work and connected to the company, Claffey said. At Suffolk Construction, employees raise money — through fund-raisers and weekly payroll donations — to give to fellow workers in need. That might include outfitting someone’s home for wheelchair access or sending an employee’s sick child to Disney World. Suffolk’s Northeast employees alone raise more than $100,000 a year for the fund.

Finding meaning in work is another major factor in the rankings, a quality in steady supply at Millennium, according to the company.

“Our vision is that we aspire to cure cancer,” said Lisa Adler, vice president of corporate communications. Employees “feel like they’re part of something meaningful, and that is very important for long-term satisfaction.”

Correction: Because of incomplete information provided by WorkplaceDynamics, an earlier version of this story did not include the Boston technology media and research company International Data Group, which is ranked 107th on WorkplaceDynamics’ list of 150 top places to work in the nation. There are 14 Massachusetts-based companies on the list.