powered by
Execute code in the datasets environment for all values of a vector, replacing a macro with the value in each iteration
forval(values, expr, macro = "%val")
the vector of values to loop over. For example, specifying 1:5 would loop over integers from 1 to 5.
a quoted expression (the experession must be enclosed in quotes) to evaluate in the loop which (presumably) uses the macro expression
a word to replace in the quoted expression with the values we are looping over (default: "%val")
returns NULL, invisibly
# NOT RUN { use(cars, clear=TRUE) listif() forval (2:4, "gen(speed%val, speed^%val)") listif() # }
Run the code above in your browser using DataLab