In the fight against childhood obesity, communities all over the country are banning the sale of sweets and salty snacks in public schools. But a new study suggests that the strategy may be ineffective.

Researchers at Pennsylvania State University tracked the body mass indexes of 19,450 students from fifth through eighth grade. In fifth grade, 59 percent of the children attended a school where candy, snacks or sugar-sweetened beverages were sold. By eighth grade, 86 percent did so.

The researchers compared children’s weight in schools where junk food was sold and in schools where it was banned. The scientists also evaluated eighth graders who moved into schools that sold junk food with those who did not, and children who never attended a school that sold snacks with those who did. And they compared children who always attended schools with snacks with those who moved out of such schools.

No matter how the researchers looked at the data, they could find no correlation at all between obesity and attending a school where sweets and salty snacks were available.