Dear Stata users,
I am trying to run a loop over values of a given variable, called "zaocode".
My aim is to run the loop for certain values of this variable, but the values have no logical meaning or "ordering", in the sense that I need to loop over some given values: 31 32 34 36 45 and 72 (rather than values from a given interval, or in a given range with regular increments in value)
I am trying to list the values over which to loop using the foreach loop but stata wont recognise the sintax.
I am trying to run a loop version of the following individual command for one of the values of my variable only:
_pctile price if zaocode==11, percentiles(99)
scalar p99_11 = r(r1)
Could anyone give me on how do run a loop on those commands with the specific values of zaocode mentioned above?
many thanks
I am trying to run a loop over values of a given variable, called "zaocode".
My aim is to run the loop for certain values of this variable, but the values have no logical meaning or "ordering", in the sense that I need to loop over some given values: 31 32 34 36 45 and 72 (rather than values from a given interval, or in a given range with regular increments in value)
I am trying to list the values over which to loop using the foreach loop but stata wont recognise the sintax.
I am trying to run a loop version of the following individual command for one of the values of my variable only:
_pctile price if zaocode==11, percentiles(99)
scalar p99_11 = r(r1)
Could anyone give me on how do run a loop on those commands with the specific values of zaocode mentioned above?
many thanks
Comment