Arguments are variables that are passed into and out of a macro when it is invoked. The variables are listed on the main command line and subcommand lines of the macro. If you pass a global worksheet variable (a column, constant, or matrix) to a macro and the macro changes the value of that variable, the global worksheet variable will contain that changed value after the macro executes. An argument can be a variable which represents:
Suppose that you want a macro that will draw a scatter plot with a fitted regression line and 95% confidence bands. Using a global macro for this situation would require you to specify, or predetermine, which columns contain the data while creating the macro. While invoking the global macro, you would not be able to specify different columns for the command.
However, with a local macro, you could specify which columns to use either when you create the macro, or when you invoke the macro using variable arguments. The undetermined column specification variables, used when creating the local macro for this situation, are examples of arguments. They allow you to enter whatever columns you wish when you invoke the macro.
Arguments can also be used to tell the macro the name of a file to open, the title of a graph, or the number of times to repeat some action. In addition, arguments can tell the local macro where to store results when the macro is finished processing.
Within the macro, you can also change the name of a variable passed in as an argument, then pass the name back out to the global worksheet. For example, the variable K1 could be given the name TestMean within the macro; when the macro finished, K1 would show the name TestMean in the Constants folder in the Project manager.
The three arguments in the following template are X, XBAR, and PCT. X is a column that contains the data, XBAR is the constant where the answer will be stored, and PCT is an optional constant that affects the subcommand. All three arguments will be given specific values when the macro is invoked.
TRIM2 X XBAR;
PERCENT PCT.