FOCUS AREAS


Contents | SAS Program | PDF

The %MktMerge Macro

Introduction

The %MktMerge autocall macro merges a data set that contains a choice design with choice data.

%MktMerge Macro Syntax

%MktMerge(DESIGN=SAS-data-set, NALTS=n, NSETS=n, SETVARS=variable-list <, optional arguments>)

Required Arguments

DESIGN=SAS-data-set

specifies an input SAS data set that contains the choice design. This data set could have been created, for example, using the %MktRoll or %ChoicEff macro.

NALTS=n

specifies the number of alternatives.

NSETS=n

specifies the number of choice sets.

SETVARS=variable-list

specifies a list of variables, one per choice set, in the DATA= data set that contains the numbers of the chosen alternatives. It is assumed that the values of these variables range from 1 to the value of the NALTS= argument.

Optional Arguments

BLOCKS=1 | variable

specifies how blocking is performed. You can specify the following values:

1

suppresses blocking.

variable

specifies the name of a variable in the DATA= data set that indexes the blocks. It is assumed that the DESIGN= data set contains blocks of nalts $\times $ nsets observations, one set per block, where nalts is the value of the NALTS= argument and nsets is the value of the NSETS= argument. The variable must contain the values 1, 2, $\ldots $ , n for n blocks.

By default, BLOCKS=1.

DATA=SAS-data-set

specifies an input SAS data set that contains data for the choice model. By default, the DATA= data set is the last data set that is created.

OUT=SAS-data-set

specifies the output SAS data set. If you do not specify this argument, the DATA$n$ convention is used. This data set contains the experimental design and the variable C, which contains 1 for the chosen alternatives (first choice) and 2 for unchosen alternatives (second or subsequent choice).

STATEMENTS=SAS-statements

specifies additional statements such as FORMAT and LABEL statements. This argument is illustrated in the following step:

%mktmerge(design=rolled, data=results, out=res2, blocks=form,
          nsets=&n, nalts=&m, setvars=choose1-choose&n,
          statements=%str(price = input(put(price, price.), 5.);
                          format scene scene. lodge lodge.;))

Help Option

You can specify either of the following to display the argument names and simple examples of the macro syntax:

%mktmerge(help)
%mktmerge(?)

%MktMerge Macro Notes

This macro specifies options nonotes throughout most of its execution. If you want to see all the notes, submit the following statement before running the macro:

%let mktopts = notes;

To see the macro version, submit the following statement before running the macro:

%let mktopts = version;

Example

The following shows a typical example of using this macro:

%mktmerge(design=rolled, data=results, out=res2,
          nsets=18, nalts=5, setvars=choose1-choose18)

The DESIGN= data set comes from the %MktRoll macro. The DATA= data set contains the response data, and the SETVARS= variables in the DATA= data set contain the numbers of the chosen alternatives for each of the 18 choice sets. The NSETS= argument specifies the number of choice sets, and the NALTS= argument specifies the number of alternatives. The OUT= argument names the output SAS data set that contains the experimental design and the variable C, which contains 1 for the chosen alternatives (first choice) and 2 for unchosen alternatives (second or subsequent choice).

When the DATA= data set contains a blocking variable, you specify its name in the BLOCKS= argument. When there is blocking, it is assumed that the DESIGN= data set contains blocks of nalts $\times $ nsets observations. The BLOCKS= variable must contain the values 1, 2, $\ldots $ , $n$ for $n$ blocks. The following example uses the %MktMerge macro with blocking:

%mktmerge(design=rolled, data=results, out=res2, blocks=form,
          nsets=18, nalts=5, setvars=choose1-choose18)