[AMPL 24723] Generate all subsets of a universal set in AMPL

I am needing to write a general way to construct a set that contains all the subsets of a universal set.

For example: Let A be the universal set, and S be the set containing all the subsets of A.

A = {a1, a2, a3}
S = {{∅}, {a1}, {a2}, {a3}, {a1, a2}, {a1, a3}, {a2, a3}, {a1, a2, a3}}

How can I construct the set S in a general way?

See How can I get AMPL to index over the “power set” consisting of all subsets of a set? in our new AMPL User Forum.